我只想发送附件附件的电子邮件。我刚刚在开发者网站上完成了所有工作。
https://developer.android.com/training/sharing/send.html
它打开了电子邮件意图选择器,但当我点击选择器中的任何应用程序时,它不会打开任何应用程序来发送带附件的邮件。我想在Android Manifest文件中添加的任何内容。
帮助更受欢迎。
我也从日志中收到消息:
06-02 11:49:36.751: W/ContextImpl(16313): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:830 com.samsung.android.share.SShareLogging.insertLog:74 com.android.internal.app.ResolverActivity.onTargetSelected:1223 com.android.internal.app.ChooserActivity.onTargetSelected:386 com.android.internal.app.ResolverActivity.startSelected:1040
06-02 11:49:36.771: W/AudioPolicyIntefaceImpl(3069): Skipped to add effects on session 2024
答案 0 :(得分:0)
使用此代码,这可能对您有所帮助
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:" + "" + receiver_mail);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "body");
try {
startActivity(Intent.createChooser(emailIntent, "Send email using..."));
}
catch (android.content.ActivityNotFoundException ex)
{
Toast.makeText(ClusteringMinimaTest.this, "No email clients installed.", Toast.LENGTH_SHORT).show();
}
答案 1 :(得分:0)
尝试以下代码。
try {
final Intent emailIntent = new Intent(
android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "YOUR_RECIEPINTS" });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"YOUR_SUBJECT");
if (URI != null) {
emailIntent.putExtra(Intent.EXTRA_STREAM, URI);
}
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "YOUR_MESSAGE");
this.startActivity(Intent.createChooser(emailIntent,
"Sending email..."));
} catch (Throwable t) {
Toast.makeText(this,
"Request failed try again: " + t.toString(),
Toast.LENGTH_LONG).show();
}
如果它提供任何权限异常,则使用以下权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />