As document from facebook, we can send image from android app to facebook messenger like below.
String metadata = "{ \"image\" : \"trees\" }";
ShareToMessengerParams shareToMessengerParams =
ShareToMessengerParams.newBuilder(contentUri, "image/jpeg")
.setMetaData(metadata)
.build();
// Sharing from an Activity
MessengerUtils.shareToMessenger(this, 0, shareToMessengerParams);
But I want to send just text. So I tried below.
ShareToMessengerParams shareToMessengerParams =
ShareToMessengerParams.newBuilder(null, "text/plain")
.setMetaData("text to send")
.build();
// Sharing from an Activity
MessengerUtils.shareToMessenger(this, 0, shareToMessengerParams);
When I tested this, java.lang.NullPointerException: Must provide non-null uri exception occurs.
How can I send message to facebook messenger..? Using Intent is not available now, so I need to use facebook sdk 4.X.