Camilo Ortegón
Camilo Ortegón

Reputation: 3692

Capture intent destination

I have an Android app with an option to share the app:

Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT,
                activity.getResources().getString(R.string.share_checkout)
                +": https://play.google.com/store/apps/details?id=co.mountainreacher.nocropforwhatsapp");
        sendIntent.setType("text/plain");
        activity.startActivity(sendIntent);

For analysis purposes I would like to know what app is the user choosing to share the content:

enter image description here

Is that posible?

Upvotes: 0

Views: 240

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006789

On Android 5.1 and higher, you can use EXTRA_CHOSEN_COMPONENT_INTENT_SENDER to find out what choice the user made in the chooser.

Prior to that, the only way to know what the user chooses is to skip the system chooser and implement your own, using PackageManager and queryIntentActivities().

Upvotes: 3

Related Questions