简体   繁体   中英

How to know which application the user chose when using an intent chooser?

I'm using an intent chooser to invite friends :

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, Resources.getString("InvitationSubject", getBaseContext()));

String body = Resources.getString("InvitationBody", getBaseContext()) + Local.User.FirstName;

intent.putExtra(Intent.EXTRA_TEXT, body);

startActivity(Intent.createChooser(intent, "Invite friends"));

Is there a way to know which app the user selected in the chooser ?

As far as I know, there is no direct way to gather such information. What would you need it for? Imho the android intent system was designed so you, as an app developer, don't have to worry about what app the user chose to handle your intent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM