1

I have this code.

public static void sharedWhatsappOrHandout(Activity destination, String stringShared){
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, stringShared);
    sendIntent.setType("text/plain");
    sendIntent.setPackage("com.whatsapp");
    if (sendIntent != null) {
        destination.startActivity(sendIntent);
    } else {
        sendIntent.setPackage("com.google.android.talk");
        if (sendIntent != null) {
            destination.startActivityForResult(sendIntent,REQUEST_CODE);
        } else {
            Toast.makeText(destination, R.string.error_no_whatsapp, Toast.LENGTH_SHORT)
                .show();
        }
    }

}

How do I know if the user actually shared or he cancelled the sharing activity?

Markus Amalthea Magnuson
  • 8,415
  • 4
  • 41
  • 49
Cabezas
  • 9,329
  • 7
  • 67
  • 69

0 Answers0