I have updated the dependency of Facebook SDK to 4.1.0. They changed a lot and now I cannot find a way to share text and image with Messenger.
Before updating the sdk I was using:
FacebookDialog.MessageDialogBuilder builder = new FacebookDialog.MessageDialogBuilder(this)
.setName(linkName)
.setDescription(description)
.setLink(webLink)
.setPicture(pictureLink);
FacebookDialog dialog = builder.build();
dialog.present();
Now 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 anyone explain a equivalent way to share text and image as before 4.1.0 please?
I found out that there is a similar way to share on Facebook which works also 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 doc is under Sharing section and not Messenger one https://developers.facebook.com/docs/sharing/android
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With