How to launch email client from my app in such a m

2019-02-19 22:09发布

问题:

When I launch email client from my application, a compose window of email client gets opened but when I launch like this, I am unable to see inbox, sent items etc...

In short how to launch email client from app exactly like launching from desktop?

Any suggestions will be appreciated.

回答1:

in short how to launch email client from app exactly like launching from desktop..

There is no standard Intent for this, sorry.



回答2:

you can try this from your activity object:

it will not necessarily take you to the Inbox directly but it will open the email application:

Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email");
startActivity(intent);

Samer Alameer



回答3:

Just in case anyone else gets here with the same question, there is a solution.

Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(ComponentName.unflattenFromString("com.google.android.email/com.android.email.activity.Welcome"));
intent.addCategory("android.intent.category.LAUNCHER");
startActivity(intent);

You can get the component name from LogCat. The only problem is, I think, if the user uses another application for email.