Google+集成不会显示具有单个Google帐户的设备的帐户选择器

时间:2014-01-28 09:04:56

标签: android google-play-services

我正在尝试在我的某个Android应用中实施Google+集成。但是,如果我的设备上只有一个帐户,我就看不到帐号选择器了。

如何在这种情况下显示帐户选择器?

1 个答案:

答案 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;
                        }

                }