Android中的GPlus登录:Plus.PeopleApi.getCurrentPerson仅在3G

时间:2015-08-01 17:45:55

标签: android

我正在使用谷歌登录我的Android应用程序。在尝试检索配置文件信息并显示已登录用户的名称时,我看到Plus.PeopleApi.getCurrentPerson仅在我使用3G (移动数据)时才返回null

我确实看到电子邮件地址被正确检索(使用Plus.AccountApi.getAccountName(mGoogleApiClient))所以我圈子中的所有人都是....只有getCurrentPerson为null因此不允许我访问getCurrentPerson.getDisplayName()。

在无线互联网连接上完全正常,我可以检索所有人员详细信息,包括电子邮件和显示名称。

我已经检查过以确保开发人员控制台上包含正确的GPlus API,SHA1签名与我在网上找到的其他可能建议相匹配。

想知道在3G网络上连接时有什么不同,只检索到getCurrentPerson。感谢任何帮助!谢谢!

我的代码:

 mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(Plus.API)
                .addScope(Plus.SCOPE_PLUS_LOGIN)
                .addScope(Plus.SCOPE_PLUS_PROFILE)
                .build();

 Person gplusPerson= Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
  if (gplusPerson!=null)
  {
      loggedInUser=gplusPerson.getDisplayName();
  }
  loggedInUserEmail= Plus.AccountApi.getAccountName(mGoogleApiClient);

0 个答案:

没有答案