Email Intent not showing the chooser
I'm using the following to initiate the sending of an email:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc882");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{s});
startActivity(Intent.createChooser(i, "Send mail..."));
The problem that I'm having开发者_C百科 is that (on my phone) it pulls up Gmail's Compose window instead of allowing me to choose which email client I'd like to send the message with.
Am I doing this wrong, or does the default email client just not respond to email send intents?
It might not respond to message/rfc882
Intents
. Try text/plain
instead, if you can, as I'm pretty sure that works.
It's a common misconception to use text/plain
. This will trigger any application that can handle plain text files without any context, including Google Drive, Dropbox, Evernote and Skype.
Instead use a ACTION_SENDTO
, providing the mailto:
Uri:
intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"));
startActivity(intent);
精彩评论