Share with Facebook Messenger

I updated the SDK dependency on Facebook to 4.1.0. They have changed a lot, and now I can’t find a way to share text and image with Messenger.

Before updating sdk, I used:

FacebookDialog.MessageDialogBuilder builder = new FacebookDialog.MessageDialogBuilder(this)
            .setName(linkName)
            .setDescription(description)
            .setLink(webLink)
            .setPicture(pictureLink);

    FacebookDialog dialog = builder.build();
    dialog.present();

Now it looks like I can only share images.

String mimeType = "image/jpeg";
ShareToMessengerParams shareToMessengerParams =
        ShareToMessengerParams.newBuilder(contentUri, mimeType)
                .build();
MessengerUtils.shareToMessenger(
       this,
       REQUEST_CODE_SHARE_TO_MESSENGER,
       shareToMessengerParams);

Can someone explain the equivalent way of exchanging text and image, as before 4.1.0, please?

+4
source share
1 answer

I found out that there is a similar way to share on Facebook, which also works for Messenger.

Here is the code

ShareLinkContent.Builder shareLinkContentBuilder = new ShareLinkContent.Builder()
            .setContentTitle(contentTitle)
            .setContentDescription(contentDescription)
            .setContentUrl(Uri.parse(url));
    shareLinkContentBuilder.setImageUrl(Uri.parse(imageUrl));
    MessageDialog messageDialog = new MessageDialog(activity);
    messageDialog.registerCallback(callbackManager, callback);
    messageDialog.show(shareLinkContentBuilder.build());

The relative document is in the "Separation" section, not the "Messenger" https://developers.facebook.com/docs/sharing/android

+8
source

All Articles