Android email chooser

前端 未结 3 1836
遇见更好的自我
遇见更好的自我 2020-12-10 00:04

I am writing an app that needs to send emails at the end of each transaction. I am doing the following:

Intent mail = new Intent(Intent.ACTION_SEND);
mail.s         


        
3条回答
  •  抹茶落季
    2020-12-10 00:41

    It's a common misconception to use text/plain or text/html. This will trigger any application that can handle plain or HTML 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:"));
    

    You can then proceed using the chooser as suggested through the other answers.

提交回复
热议问题