I have the following code to start an email client in my application, but when I try to run it I get an error that says: "No apps can perform this action"
I've looked through a bunch of tutorials and other posts on here but the code seems to match everyone else's. Does anyone have any idea why i'm getting this error?
Intent emailI = new Intent(Intent.ACTION_SEND);
emailI.putExtra(Intent.EXTRA_EMAIL, new String[] {"sample@email.com"});
emailI.putExtra(Intent.EXTRA_CC, new String[]{"your@email.com"});
emailI.putExtra(Intent.EXTRA_SUBJECT, "subject");
emailI.putExtra(Intent.EXTRA_TEXT, "Body");
emailI.setType("message/rfc822");
startActivity(Intent.createChooser(emailI, "Open Email Client"));
EDIT: Turns out I had to setup the email application on the virtual device first and then run the code. Thanks.
I try to run it I get an error that says: "No apps can perform this action
This simply means there's no app to deal with the intent you are sending.
EDIT
The fact there's email app installed does not mean it got intent-filter
for message/rfc822
payload (that's why I suggested using text/plain
instead, at least for testing).
BTW: there's neat tool, Intent Intercept useful with intent debuging.