【问题标题】:Configure exchange email account via Android API通过 Android API 配置交换电子邮件帐户
【发布时间】:2011-10-26 10:53:17
【问题描述】:

我想编写一个应用程序,给定用户名和密码,将(除其他外)在设备上配置交换电子邮件电子邮件帐户。可以通过Android API吗?如果有,通过什么课程?

【问题讨论】:

标签: android api email exchange-server


【解决方案1】:

在 3.0 之前的版本中,有一种方法可以通过将用户名和密码作为附加值传递来配置交换电子邮件。

ComponentName cname = new ComponentName("com.android.email", "com.android.email.activity.setup.AccountSetupBasics");
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.putExtra("com.android.email.AccountSetupBasics.username", emailAddress);
            intent.putExtra("com.android.email.AccountSetupBasics.password", config.password);
            intent.putExtra("com.android.email.extra.eas_flow", true);
            intent.setComponent(cname);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);

【讨论】:

  • 我尝试使用此代码,但出现异常“找不到活动”:/,我在 android 2.3.6 上运行它...
  • 是哪款手机??可能他们有一个自定义的电子邮件客户端??
  • 是nexus one。我收到错误消息“无法找到显式活动类 {com.android.email/com.android.email.activity.setup.AccountSetupBasics};您是否在 AndroidManifest.xml 中声明了此活动?”
猜你喜欢
  • 2012-02-21
  • 2012-06-27
  • 2011-05-21
  • 2011-11-16
  • 1970-01-01
  • 2013-03-12
  • 2020-09-07
  • 1970-01-01
  • 2018-12-28
相关资源
最近更新 更多