[英]How (i.e., what intent action) to start the set up email account activity (add new email account activity) of the email application
From within my app, I'd like to start the set up new email account activity of the Email App which looks like this: http://i.stack.imgur.com/BNYnj.png 在我的应用程序中,我想开始设置电子邮件应用程序的新电子邮件帐户活动,如下所示: http : //i.stack.imgur.com/BNYnj.png
I've looked at this http://source-android.frandroid.com/packages/apps/Email/AndroidManifest.xml 我已经看过这个http://source-android.frandroid.com/packages/apps/Email/AndroidManifest.xml
and tried to start the set up email activity: 并尝试开始设置电子邮件活动:
Intent intent = new Intent("com.android.email.CREATE_ACCOUNT");
startActivity(intent);
But I got an exception: E/AndroidRuntime(517): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.email.CREATE_ACCOUNT } 但我有一个例外:E / AndroidRuntime(517):android.content.ActivityNotFoundException:找不到用于处理Intent的活动{act = com.android.email.CREATE_ACCOUNT}
Anyone please help me? 有人帮我吗
Thanks so much, John 非常感谢,约翰
you could try using an explicit intent. 您可以尝试使用明确的意图。 instead of 代替
new Intent("com.android.email.CREATE_ACCOUNT")
use 采用
new Intent(context, com.android.email.activity.setup.AccountSetupBasics.class)
you may also want to look into the whole ACTION_ADD_ACCOUNT action string. 您可能还需要研究整个ACTION_ADD_ACCOUNT操作字符串。 it may do what you are looking for without having to use a SPECIFIC app. 它可能无需使用SPECIFIC应用即可满足您的需求。 for example, when an oem installs a different email app from the stock android one. 例如,当oem安装了与普通android应用不同的电子邮件应用时。 if it happens there won't be anything to handle either the explicity or implicit intent. 如果发生这种情况,将无法处理显式或隐式意图。
This works for from APIs 4.0+. 这适用于APIs 4.0+。
Intent intent = new Intent("com.android.email.CREATE_ACCOUNT");
intent.putExtra("FLOW_MODE", 0);
startActivity(intent);
Below works for from APIs 2.1+. 以下适用于API 2.1+。 Maybe also work for lower versions (not tested). 也许也适用于较低版本(未测试)。
Intent intent = new Intent();
intent.setClassName("com.android.email", "com.android.email.activity.setup.AccountSetupBasics");
intent.putExtra("FLOW_MODE", 0);
startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.