I am trying to send an email from a Google Glass app I am developing. However, it seems my app can not find any application (including Gmail) to perform this action. Normally an Android phone would display several choices for sharing any kind of contents (sms, mail, blutooth), but not in Google Glass. Has anyone face the same issue?
I have tried different codes:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
startActivity(Intent.createChooser(i, "Send mail..."));
This one throws dialog saying No apps can perform this action. The following ones:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
startActivity(i);
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, "recipient@example.com");
intent.setData(Uri.parse("mailto:" + "recipient@example.com"));
intent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
intent.putExtra(Intent.EXTRA_TEXT, "xxxxxxxxxxxxxxxxx");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
say No activity found to handle intent. I am able to send/receive mails with the Gmail account in the Google Glass timeline, but it looks like my app is not recognizing it or the other way around. Any clue?
I have seen it can be done by implementing my own mail service using JavaMail API, for instance, but I dont want the user to entry passwords and neither the code to contain them.
Thanks in advance.