开发者

Running Accounts & sync settings

开发者 https://www.devze.com 2023-03-19 07:43 出处:网络
I am currently retrieving the users gmail username using An开发者_如何学运维droid\'s AccountManager class.

I am currently retrieving the users gmail username using An开发者_如何学运维droid's AccountManager class. My problem is that my app assumes that the user has already added his Google account to his Android phone and I would just like to ask if it is possible to launch the Account & sync settings app in case the user has not actually bound his Google account to his phone?

 AccountManager accountManager = AccountManager.get(getApplicationContext());
 Account[] accounts = accountManager.getAccountsByType("com.google");
 if (accounts.length == 0) // How?
    // run Accounts & sync settings so that the user can add his Google account


Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
startActivity(intent);

http://developer.android.com/reference/android/provider/Settings.html#ACTION_SYNC_SETTINGS

0

精彩评论

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