I want to known what is the purpose of the IntentSender
class for our application? How do we use it in our application?
Are there any good examples, apart from The Android Intent Based APIs: Part Seven – IntentSenders And PendingIntents?
IntentSender
is kind of a level of abstraction or glue class that allows you to
Receive broadcast when user selects application in chooser.
Example when you use IntentSender
:
Intent intent = new Intent(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_TEXT, "This is my text to send.") .setType("text/plain"); Intent receiver = new Intent(this, BroadcastTest.class) .putExtra("test", "test"); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, receiver, PendingIntent.FLAG_UPDATE_CURRENT); Intent chooser = Intent.createChooser(intent, "test", pendingIntent.getIntentSender()); startActivity(chooser);
Start Activity
with IntentSender
instead of Intent
(more in Android docs)
startIntentSender(IntentSender intent, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)
Like
startActivity(Intent, Bundle)
, but taking aIntentSender
to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With