只有电子邮件应用程序来解决一个意图 [英] Only Email apps to resolve an Intent
问题描述
我有一个问题..我只想通过电子邮件活动来解决意图 ACTION.SEND 但除了电子邮件我还得到其他应用程序(例如 TubeMate),即使我已将 mime 类型设置为message/rfc822"...知道如何让电子邮件应用程序解决它..
I have a problem .. I want only email activities to resolve intent ACTION.SEND but beside email I get other apps as well (e.g TubeMate) even though I have set the mime type as 'message/rfc822' ... Any idea how can I get Email applications to resolve it ..
推荐答案
String recepientEmail = ""; // either set to destination email or leave empty
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:" + recepientEmail));
startActivity(intent);
重点是使用ACTION_SENDTO
作为动作,mailto:
作为数据.如果您想让用户指定目标电子邮件,只需使用 mailto:
;如果您自己指定电子邮件,请使用 mailto:name@domain.com
The point is to use ACTION_SENDTO
as action and mailto:
as data. If you want to let the user specify the destination email, use just mailto:
; if you specify email yourself, use mailto:name@domain.com
建议的方法过滤所有可以发送电子邮件的应用程序(例如默认的电子邮件应用程序或gmail)
Suggested method filters all the application, that can send email(such as default email app or gmail)
这篇关于只有电子邮件应用程序来解决一个意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!