ShareDialog shareDialog = new ShareDialog(this);
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Toast.makeText(SharePage.this, "ok", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException error) {
Toast.makeText(SharePage.this, error.getMessage(), Toast.LENGTH_LONG).show();
}
});
SharePhoto photo = new SharePhoto.Builder().setBitmap(bm).setCaption(description).build();
SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(photo).build();
shareDialog.show(content);
The below code is run.
If i have facebook app in the mobile, it's share the photo successful.
But if i delete the facebook app, the callbackManager return the error "Unable to show the provided content via the web or the installed version of the Facebook app. Some dialogs are only supported starting API 14.
"
You can only show this dialog if you have native facebook app installed in your device. Try the same code in a device in which facebook app is installed it will work. If you want to make a custom dialog you need to
Here's the code for posting a link to Facebook from your own interface:
Let me know if you need any assistance. Mark this answer accepted if this helps.