I'm developing an application that uses the Facebook share dialog. Here's my dialog implementation:
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
.setLink(playStoreLink)
.setName(appName)
.setDescription("I'm here with "+name)
.setPicture(linkPicture)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
And here's the onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() {
@Override
public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
Utilities.GeneralDismissableDialog(context, String.format("Error: %s", error.toString()));
}
@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
Toast.makeText(context, "Success!", Toast.LENGTH_LONG).show();
}
});
}
Now if the user press the back button, the onComplete
method is invoked, so the application prints the success message "Success!".
I read the dcomunetation but i didn't find any suggestions.
How can i manage the cancellation by the user?