I'm implementing Facebook sharing feature in my app. I took the code from the example https://developers.facebook.com/docs/sharing/android (Share Dialog)
FacebookCallback is implementing 3 methods onSuccess, onCancel, onError.
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
@Override
public void onSuccess(Sharer.Result result) {
Timber.e("onSuccess " + result.getPostId());
}
@Override
public void onCancel() {
Timber.e("onCancel");
}
@Override
public void onError(FacebookException e) {
Timber.e("onError");
}
});
I want to know if user cancels share dialog instead of sharing content. But for some reasons onSuccess is called and result.getPostId() is null in both cases if user successfully shares content or cancels dialog. Why onCancel isn't called if user pressed back and why result.getPostId() is null even if post was shared successfully?