Android Facebook Share does not show description on facebook wall

When my application tries to share something, the description is displayed in the share activity, but it is not displayed when it is sent. I went through a lot of stackoverflow posts, but nothing could solve my problem.

Here is my call flow:

  • Submit button pressed
  • Activity calls a static method and passes itself and content to share it through the bundle
  • The Share action is called from this static method. It displays content for sharing all images, titles and descriptions.
  • Content Used Successfully
  • When the facebook message is checked, it just shows the details of the PlayStore application, the image I set to 3, without a description

Here is the code I'm using

if (FacebookDialog.canPresentShareDialog(activity.getApplicationContext(), 
     FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) 
    {
     FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(activity)
           .setLink("<playstore link>")
           .setApplicationName("<appname>")
           .setName("<some name>")
           .setCaption("<some text>")
           .setDescription("a description")
           .setPicture("http://url/to/image.jpg")
           .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    }

FeedDialog

Bundle params = new Bundle();
                    params.putString("name", "name");
                    params.putString("caption", "caption");
                    params.putString("description","desc");
                    params.putString("link", "playstore link");
                    params.putString("picture", "http://url/to/image.jpg");

                    WebDialog feedDialog = (
                        new WebDialog.FeedDialogBuilder(activity,
                                session,
                            params))
                        .setOnCompleteListener(new OnCompleteListener() {

                            @Override
                            public void onComplete(Bundle values,
                                FacebookException error) {
                                if (error == null) {

                                    final String postId = values.getString("post_id");
                                    if (postId != null) {
                                        Toast.makeText(activity,

                                            "Posted Successfully!",
                                            Toast.LENGTH_SHORT).show();
                                        activity.finish();
                                    } else {
                                        // User clicked the Cancel button
                                        Toast.makeText(activity.getApplicationContext(), 
                                            "Publish cancelled", 
                                            Toast.LENGTH_SHORT).show();

                                        activity.finish();
                                    }
                                } else if (error instanceof FacebookOperationCanceledException) {
                                    // User clicked the "x" button
                                    Toast.makeText(activity.getApplicationContext(), 
                                        "Publish cancelled", 
                                        Toast.LENGTH_SHORT).show();
                                    activity.finish();
                                } else {

                                    Toast.makeText(activity.getApplicationContext(), 
                                        "An Error Occurred", 
                                        Toast.LENGTH_SHORT).show();
                                    activity.finish();
                                }


                            }



                        })
                        .build();
                    feedDialog.show();

+4
2

docs ( 4.0 +)

ShareDialog , ShareDialog onCreate:

public class MainActivity extends FragmentActivity {
    CallbackManager callbackManager;
    ShareDialog shareDialog;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        callbackManager = CallbackManager.Factory.create();
        shareDialog = new ShareDialog(this);
        // this part is optional
        shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() { ... });
    }

ShareDialog:

if (ShareDialog.canShow(ShareLinkContent.class)) {
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
            .setContentTitle("Hello Facebook")
            .setContentDescription(
                    "The 'Hello Facebook' sample  showcases simple Facebook integration")
            .setContentUrl(Uri.parse("http://developers.facebook.com/android"))
            .build();

    shareDialog.show(linkContent);
}
+1

Slartibartfast compile 'com.facebook.android:facebook-android-sdk:4.24.0'

Facebook SDK 4.25.0

setContentTitle("") setContentDescription("") . setQuote(""); setContentDescription("");

. : https://developers.facebook.com/docs/sharing/android

0

All Articles