Home » Android » facebook – How to confirm Android Share Intent is successful or complete

facebook – How to confirm Android Share Intent is successful or complete

Posted by: admin June 15, 2020 Leave a comment


Is there a way to confirm if a Share intent in Android was successful or unsuccessful? (For example, if I share a Facebook post, I’d like to know if it was successfully posted or know if it was cancelled.)

Below is the Android intent code that I use to Share. Currently, it launches a dialog to allow the user to choose which app to share to:

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);    
activity.startActivity(Intent.createChooser(shareIntent, title));
How to&Answers:

Personally, I was about to say “use startActivityForResult()” and check what gets returned. However, as you can read more here, it’s not as simple as that. If the intent is cancelled by the user, the same number is returned as if the intent was completed (for most appications).

Ultimately, at the moment for a simpler Share intent in general, you cannot check if it’s successful or not.


In case of FacebookShareDialog Build your dialog with requestCode then onActivity check the Request code and Result code. For this there is one class in Facebook Sdk Name UiLifecycleHelper

in onCreate Method

uiHelper = new UiLifecycleHelper(this, null);

 FacebookDialog fbShardialog = new FacebookDialog.ShareDialogBuilder(



 if (requestCode == 12) {
        if (resultCode == RESULT_OK) {
            //  show sucess message

//show failure message