通过Android的API配置Exchange电子邮件帐户帐户、电子邮件、Android、API

2023-09-06 07:20:23 作者:人才

我喜欢写,给定一个用户名和密码的应用程序,将(除其他事项外),配置设备上的Exchange电子邮件的电子邮件帐户。是否有可能通过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是有办法通过传递用户名和密码的额外配置Exchange电子邮件。

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);