【发布时间】:2015-03-23 10:14:55
【问题描述】:
我正在尝试在我的桌子上的 android 应用程序中使用本机电子邮件撰写,以便在应用程序崩溃时向我发送日志。
下面的代码运行良好,但会弹出原生电子邮件撰写,您必须按发送。有没有办法告诉撰写应用程序只是发送电子邮件。无需手动点击即可发送?
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
intent.setType("message/rfc822");
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
intent.putExtra(Intent.EXTRA_TEXT, "Body of email");
intent.setData(Uri.parse("myeamil@yahoo.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
//startActivity(intent);
谢谢。 最大
【问题讨论】: