我正在尝试在我的某个Android应用中实施Google+集成。但是,如果我的设备上只有一个帐户,我就看不到帐号选择器了。
如何在这种情况下显示帐户选择器?
答案 0 :(得分:0)
这就是我展示它的方式:
scopes.add(AnalyticsScopes.ANALYTICS_READONLY);
credential = GoogleAccountCredential.usingOAuth2(this, scopes);
if (TextUtils.isEmpty(appPreferences.getUserName()))
{
try
{
startActivityForResult(credential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(this, getString(R.string.gps_missing), Toast.LENGTH_LONG).show();
return;
}
}