I'm sending mail from gmail default email client composer. Now I have following concerns regarding sending mail:
- In Android older versions, when I sent mail from gmail composer then by device back button I'm able to come back to my app, however in Android Marshmallow it goes to gmail instead to come back to my app (Not sure about Lollipop)
- In any of Android version I don't have feature to get callback response from gmail to check whether my mail has been sent or not.
I'm using following code to sending mail
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
final PackageManager pm = getPackageManager();
final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0);
ResolveInfo best = null;
for (final ResolveInfo info : matches)
if (info.activityInfo.packageName.endsWith(".gm") ||
info.activityInfo.name.toLowerCase().contains("gmail")) best = info;
if (best != null)
intent.setClassName(best.activityInfo.packageName, best.activityInfo.name);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailId});
startActivity(intent)
I went through such links :
Sending email on android via default email application
(And many more)
Please Help!