Configure exchange email account via Android API

2019-02-16 01:48发布

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?

1条回答
Lonely孤独者°
2楼-- · 2019-02-16 02:32

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);
查看更多
登录 后发表回答