いくつかのデフォルトの指示で特定のメールアドレスにメールを送信したいと思います。ユーザーの介入なしにAndroidアプリからメールを送信
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String\[\]{ "[email protected]"});
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here");
intent.setType("message/rfc822");
try {
startActivity(Intent.createChooser(intent,
"Send email using..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getActivity(),
"No email clients installed.",
Toast.LENGTH_SHORT).show();
}
}
});
代わりにサービスを使用してください。 – Amy