I'm using Intent.ACTION_SEND
to send an email. However, when I call the intent
it is showing choices to send a message, send an email, and also to send via bluetooth. I want it to only show choices to send an email. How can I do this?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I notice, that this is an pretty old question but it is the first result when searching for a "Send mail" solution and all answers have a common problem:
Using
Intent.ACTION_SEND
andintent.setType("message/rfc822")
will result in a chooser that not only shows mail apps but all apps that can handle any MIME type support by message/rfc822, e.g..mhtml
,.mht
,.mime
. Beside mail apps this could be Google Drive, Dropbox, Evernote, etc.The only solution I found to limit the chooser to mail apps only is to use Intent.ACTION_SENDTO instead:
I had a similar problem with my app. I recently found this link form the official android developers site that really helps! Common Intents: Email
TL;DR:
Now, you will only be shown email clients!
You can add a Subject and Body by doing this:
This will open only the Email app installed in your android phone.
Using
message/rfc822
type as pointed here: ACTION_SEND force sending with email solves the issue.Best code to restrict it to only send an email. set this type to only send an email.
i.setType("message/rfc822");
This will help you.