开发者

Email Intent not showing the chooser

开发者 https://www.devze.com 2022-12-12 16:29 出处:网络
I\'m using the following to initiate the sending of an email: Intent i = new Intent(Intent.ACTION_SEND);

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

精彩评论

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