开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜