My app integrates e-mail where the user can submit a bug report, feedback, etc. from the app directly. I'm using the application/octet-stream as the SetType for the Intent. When you go to submit the e-mail you get the content chooser and it shows various items from Evernote, Facebook, E-mail, etc.
How can I get this chooser to only show E-mail so as not to confuse the user with all these other items that fit the content chooser type?
Thank you.
It works on all devices. It will show only Email Apps
I solved this issue with simple lines of code as in the android documentation explain (https://developer.android.com/guide/components/intents-common.html#Email)
The most important is the flag: it is
ACTION_SENDTO
, and notACTION_SEND
The other important line is
By the way, if you send an empty
Extra
, theif()
at the end won't work and the app won't launch the email client.This works for me. According to Android documentation. If you want to ensure that your intent is handled only by an email app (and not other text messaging or social apps), then use the ACTION_SENDTO action and include the "mailto:" data scheme. For example:
Just struggled with this problem while implementing a Magic Link feature, a chooser intent for all installed email apps:
Chooser Intent Screenshot
It is possible to limit the choices of an intent chooser to just a few options. The code in the answer to this question is a good example. In essence, you would have to create a List of LabeledIntents to provide to the intent chooser, that will then include it in its list. Note that this solution works not on exclusion (certain apps are excluded while the rest remain) but instead you have to pick which apps to display. Hope it helps!
Solution is very simple:
See: http://www.gaanza.com/blog/email-client-intent-android/
It works on all devices.It will show only Email Apps