Multiple Intent receivers?

2019-06-26 06:06发布

问题:

Documentation states that if an Intent can be processed by multiple applications the user will be prompted with a dialog asking him to choose the application to complete the action. Is there any way to make user select multiple applications that will complete the action one by one? For example, if I want to share a message I'll be using ACTION_SEND with a specified MIME type and I'll be prompted with a list of applications that can share the message. Can I make a user choose multiple apps to share message on Twitter, Facebook etc. at the same time? Thanks.

回答1:

Is there any way to make user select multiple applications that will complete the action one by one?

Not native to Android.

That being said, there is nothing stopping you from using PackageManager and queryIntentActivities() to create your own chooser that allows multiple selection, then dispatches the event to each checked item one by one.



回答2:

The way OS handles it, seems no. You talk about this, right? Because you load text, and/or image, and then sharing it. Lot of apps can handle it, but every app handles it with different way. May the app who when get text and/or img, do nothing!

e.g G+, asks you what circles you want to share with. facebook i dont know, i dont use it. SMS/MMS: may see if there is a picture or something to choose between them.

Even dropbox sometimes thinks can handle some sharings, but eventually it cant!

Also, there is no option for multiple select in sharing.

If there was, what was going to happen? eg selected g+ and twitter, open first the G+ New post Activity, and when you finish, open the Twitter one?

Maybe using API's for those soc. networks, but user may have to give again its credencials.