Get user selection from intent chooser

Chibatching
Sep 3, 2018 · 1 min read

This article shows how can we know user decision on intent chooser you created.

  • requirement: Android 5.1+

If you want know which app was selected by user when showing intent chooser, you should implement the chooser with IntentSender that will callback the user selection.

IntentSender is created from PendingIntent. It means you can/should launch Service or BroadcastReceiver instead of your Activity to prevent interrupting the user operation on the selected app.

Receiver or Service can extract ComponentName as Parcelable from Intent. You can get class name or package name from it.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade