开发者

Providing EXTRA_AUTHORITIES when showing the ACTION_ADD_ACCOUNTS in order to show restricted account types to the user

The description for EXTRA_AUTHORITIES in android.provider.Settings says :

"This can be passed as an extra field in an Activity Intent with one or more syncable content provider's authorities as a String[]. This field is used by some intents to alter the behavior of the called activity.

Example: The ACTION_ADD_ACCOUNT intent restricts the account types available based on the authority given."

I want to show only the Corporate account type (or the activesync) to the user. I'm unable to find what String constants need to be passed as EXTRA_AUTHORITI开发者_StackOverflow社区ES for this.

Can anyone point me to account type strings ? Or, provide an example of restrictively launching the add accounts page ?


Well, I hope I am not necroing anything, but you can add an authority for a content provider.

An example is in the LaunchActivity.java of the Android Calendar source, eg http://hi-android.info/src/com/android/calendar/LaunchActivity.java.html:

final Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] {
    Calendar.AUTHORITY
});
startActivityForResult(intent, 0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜