Get the list of apps capable of handling the SEND intent to display in a View (not a popup dialog)

Pierre picture Pierre · Jan 31, 2012 · Viewed 9.1k times · Source

I'm trying to get the list of all apps installed on a phone capable of handling the SEND intent. I am currently handling this situation by using Intent.createChooser but this is not what I am trying to achieve as I would like to be able to get access to the list of apps to display them in a View in my activity, in a way similar to how the Android stock Gallery app displays them and NOT in a spinner dialog.

Screenshot available here: http://i.stack.imgur.com/0dQmo.jpg

Any help would be greatly appreciated.

Answer

CommonsWare picture CommonsWare · Jan 31, 2012

Call queryIntentActivities() on PackageManager, given an ACTION_SEND Intent configured as you would use with createChooser() (i.e., has the MIME type, Uri, etc.). This will give you a list of all the matches that would appear in the chooser. You can then make use of the user's selection to launch the actual activity.

Here is a sample project that uses this to create a home screen-style launcher.