0

When I try to implement the sharing of links for the app links using the ShareDialog using ShareLinkContent, the image and title are not shown correctly when the actually the post is shared.

String url = "https://fb.me/" + id; //Id is generated by app links hosting api
ShareDialog shareDialog = new ShareDialog(activity);
if (ShareDialog.canShow(ShareLinkContent.class)) {
    ShareLinkContent.Builder linkContentBuilder = new ShareLinkContent.Builder()
        .setContentUrl(Uri.parse(url))
        .setContentTitle(contentTitle)
        .setContentDescription(contentDescription);
    if (imageUrl != null) {
        linkContentBuilder.setImageUrl(Uri.parse(imageUrl));
    }
    ShareLinkContent linkContent = linkContentBuilder.build();
    shareDialog.setShouldFailOnDataError(true);
    shareDialog.registerCallback(activity.callbackManager,
                                 new FacebookCallback<Sharer.Result>() {
        @Override
        public void onSuccess(Sharer.Result result) {
            Log.d(TAG, "Facebook sharing successful");
        }

        @Override
        public void onCancel() {
            Log.d(TAG, "Facebook sharing cancelled");
        }

        @Override
        public void onError(FacebookException e) {
            Log.d(TAG, "Facebook sharing error");
            Log.d(TAG, e.getMessage());
        }
    });
    shareDialog.show(linkContent);
}

But the sharing looks like below:

Facebook sharing

Can someone help me out?

grebulon
  • 7,697
  • 5
  • 42
  • 66
Akshay
  • 3
  • 4

0 Answers0