lundi 4 mai 2015

In whatsapp or Handout. How to know is user actually shared or cancelled sharing activity?

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();
        }
    }

}

Sameone can help me. Thanks!

Aucun commentaire:

Enregistrer un commentaire