I would like to use new version of Intent.createChooser method which uses IntentSender
.
Documentation states only that I can grab it from PendingIntent
instance. In my case it seems that PendingIntent
won't have any other use.
Is there another way to obtain IntentSender
or do I need create PendingIntent
?
Another way to do it.
the chooser target intent is not the
PendingIntent
. For instance, in the following snippet, I am declaring intent forACTION_SEND
, with typetext/plain
, and this is the my target intent for theIntent.createChooser
. Then I am creating anotherIntent
, receiver, and a handler, thePendingIntet
, which will invokeonReceive
of myBroadcastTest
after one pick something from the chooser.Edit:
The information, in the case of the
BroadcastReceiver
is embedded in the intent you get as parameter. After you selected one of the option, retrieve the Bundle's extras and using the keyandroid.intent.extra.CHOSEN_COMPONENT
, you should be able to find what the user picked.Try adding as simple Log.d to
onReceive
In my example I got
ComponentInfo{org.telegram.messenger/org.telegram.ui.LaunchActivity}
for
Telegram
andfor
InBox