Thursday 16 April 2015

Posting a status update on Facebook using 4.01


  •   Declare these variables 
  private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
  private CallbackManager callbackManager;
  private ShareDialog shareDialog;
  •  initialize callbackmanager
        callbackManager = CallbackManager.Factory.create();
  •  Now Call this method to share content on facebook (including text,url etc)
private void postStatusUpdate() {       
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setContentTitle("Hello Facebook")
                .setContentDescription(
                        "The 'Hello Facebook' sample  showcases simple Facebook integration")
                .setContentUrl(Uri.parse("http://developers.facebook.com/docs/android"))
                .build();
        ShareApi.share(linkContent, shareCallback);
       }

No comments:

Post a Comment