Reputation: 73
I try to find solution for send message in facebook for another user use sdk android. I look for open dialog, but it's not possible use sdk + send message i think, that is not possible too. all answer in stack not update longtime. maybe anyone find the solutions for that question. maybe i need to look for send message via browser use post??? or use https://developers.facebook.com/docs/messenger-platform/send-api-reference. anyone use that api sender?
yes i find https://developers.facebook.com/docs/sharing/android and https://developers.facebook.com/docs/sharing/reference/send-dialog but that not func for send message..
thanks for you time.
Upvotes: 0
Views: 981
Reputation: 73
So... i spend 2 day for find best solutions. for quick solutions you must use code like this:
mCallbackManager = CallbackManager.Factory.create();
MessageDialog messageDialog = new MessageDialog(this);
messageDialog.registerCallback(mCallbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Log.e("myLogs", "send success");
}
@Override
public void onCancel() {
Log.e("myLogs", "send cancel");
}
@Override
public void onError(FacebookException e) {
Log.e("myLogs", "send error");
}
});
if (MessageDialog.canShow(ShareLinkContent.class)) {
Uri uri = Uri.parse("http://developer.android.com/reference/android/net/Uri.html");
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("....")
.setContentDescription("asd")
.setContentUrl(uri)
.setImageUrl(Uri.parse("http://www.w3schools.com/css/paris.jpg"))
.build();
messageDialog.show(linkContent);
}
but this work just with "messenger"!!! and i think for create web part and create webhook for send request from android to webplatform and on this platform use dialog message for send a friend. But i not release this. If anyone wanna try 2nd methode and it's will be done good result. please write in this place.
good coding
Upvotes: 1