I have an android app that wants to initiate an email. The following code works in an api level 5 emulator, but not on a level 2 emulator or device:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Email from MyApp");
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"This email was autogenerated by MyApp.");
try {
startActivity(emailIntent);
} catch (Exception e) {
Log.e(TAG,e.getMessage());
showDialog(DIALOG_CANTSENDMAIL);
}
The exception thrown says:
No Activity found to handle Intent { action=android.intent.action.SEND (has extras) }
I can manually send email from all devices (emulated and real) tested, and this works in Level 5 api. The documentation on Intent.ACTION_SEND says it has been active since API level 1.