How to confirm that Android Share Intent is successful or completed

Is there a way to confirm that Share’s intention on Android was successful or unsuccessful? (For example, if I share a post on Facebook, I would like to know if it was published successfully or if it was canceled.)

Below is the Android code of intent that I use for sharing. He is currently launching a dialog allowing the user to choose which application will share:

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);    
activity.startActivity(Intent.createChooser(shareIntent, title));
+4
source share
2 answers

"use startActivityForResult()" , . , , . , , ( ).

, Share , .

+7

FacebookShareDialog requestCode, onActivity . Facebook Sdk Name UiLifecycleHelper

in onCreate Method

uiHelper = new UiLifecycleHelper(this, null);
uiHelper.onCreate(savedInstanceState);




 FacebookDialog fbShardialog = new FacebookDialog.ShareDialogBuilder(
                        MainActivity.this)
                        .setLink("http://www.claro.com.ar/")
                        .setPicture("imagepath").setRequestCode(12)
                        .build();

                uiHelper.trackPendingDialogCall(fbShardialog.present());



OnActivityResult


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

        }
 else
//show failure message

    }
0

All Articles