开发者

Running Accounts & sync settings

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜