1

I am using Intent ACTION_SEND to share a content in different social media. enter image description here

Now, disregarding other apps in there leaving twitter, facebook, instagram, How will I know if the shares have been successfully posted? Is there some kind of listener for it? Or are there intent for result features for it? Here's the Intent code

public static void shareTo(String type, String mediaPath, String caption, Context context) {


    Intent share = new Intent(Intent.ACTION_SEND);


    share.setType(type);


    File media = new File(mediaPath);
    Uri uri = Uri.fromFile(media);


    share.putExtra(Intent.EXTRA_STREAM, uri);
    share.putExtra(Intent.EXTRA_TEXT, caption);


    context.startActivity(Intent.createChooser(share, "Share to"));
}
Sheychan
  • 2,415
  • 14
  • 32

2 Answers2

4

No, sorry. You don't get any feedback on what the recipient of an ACTION_SEND intent does with it.

cketti
  • 1,277
  • 11
  • 15
  • :( I guess right, That's quite sad. . Then exploring each of the App's API is the only choice left – Sheychan Jul 10 '15 at 13:54
  • It is possible with Intent.createChooser, check out this answer by commonsware. https://stackoverflow.com/a/32203659 – AndroidDev May 09 '22 at 11:40
0

ACTION_SEND does not return any callback however some work around is below that works perfect for me.

int action_type=-1;

shareData()
{
   action_type=1;
}

@Override
protected void onResume() {
    super.onResume();
    if(action_type==1)
    {
        loadInterstitialAd();
        action_type=-1;
    }
}

Chill Pill :)

Ali Akram
  • 4,803
  • 3
  • 29
  • 38