简体   繁体   中英

Android Facebook Share ,Description not showing

I am using facebook sdk for sharing on facebook. My code is below,it's working fine.But when i want to change the content url to Application playstore link then content description is not showing into facebook. Is there any solution or i am making stupid mistake ?

if (ShareDialog.canShow(ShareLinkContent.class)) {
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setContentTitle(AppConstant.RESTURENT_NAME)
                .setContentDescription("Hi,You should check out Bangkok Eatery.")
                .setContentUrl(Uri.parse("http://developers.facebook.com/android"))
                                .build();

        shareDialog.show(linkContent);
    }
 ShareDialog shareDialog = new ShareDialog(this);
    CallbackManager callbackManager = CallbackManager.Factory.create();
    shareDialog.registerCallback(callbackManager, new
            FacebookCallback<Sharer.Result>() {
                @Override
                public void onSuccess(Sharer.Result result) {

                }

                @Override
                public void onCancel() {
                }

                @Override
                public void onError(FacebookException error) {
                }
            });
    ShareLinkContent linkContent = new ShareLinkContent.Builder()
            .setContentTitle(getString(R.string.app_name))
            .setContentDescription("")
            .setContentUrl(Uri.parse("your link"))
            .build();
    shareDialog.show(linkContent);

FacebookSdk initialize in onCreate method

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>() { ... });
}






if (ShareDialog.canShow(ShareLinkContent.class)) {
        ShareLinkContent linkContent = new ShareLinkContent.Builder()
            .setContentTitle(AppConstant.RESTURENT_NAME)
            .setContentDescription("Hi,You should check out Bangkok Eatery.")
               .setContentUrl(Uri.parse("http://developers.facebook.com/android"))
                            .build();

    shareDialog.show(linkContent);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM