通过 Android API 配置交换电子邮件帐户 [英] Configure exchange email account via Android API

查看:26
本文介绍了通过 Android API 配置交换电子邮件帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'd like to write an application that, given a username and password, will (among other things) configure an exchange email email account on the device. Is it possible to do via the Android API? If so, via what class?

推荐答案

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

In the versions prior to 3.0 there is a way to configure exchange email by passing in the UserName and Password as extras.

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 API 配置交换电子邮件帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆