谷歌Android加getCurrentPerson返回null [英] Android Google Plus getCurrentPerson returns null

查看:181
本文介绍了谷歌Android加getCurrentPerson返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打电话 plusClient.getCurrentPerson()我收到NULL。

When I'm calling plusClient.getCurrentPerson() I am getting NULL.

方法 onConnected(包...)称为成功登录后:

Method onConnected(Bundle...) called after a successful login:

@Override
public void onConnected(Bundle bundle)
{
   if (plusClient.getCurrentPerson() == null)
   {
      Log.e("DD", "Person is null !");
   }
}

我从月食( - > preferences-> Android->生成窗口)直接加入SHA1。我不知道我做错了!

I have added SHA1 directly from eclipse (Window->Preferences->Android->Build). I don't know what I am doing wrong!

在Eclipse ADT SHA1指纹

SHA1 fingerprint from Eclipse ADT

安装的应用程序的客户端ID

Client ID for installed applications

简单API访问

Simple API access

推荐答案

我刚刚发现,你需要通过多个范围,当你正在构建的PlusClient对象:

I just found out that you need to pass multiple scopes when you're building the PlusClient object:

PlusClient plusClient = new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN, Scopes.PLUS_PROFILE ,"https://www.googleapis.com/auth/userinfo.email").build();

这篇关于谷歌Android加getCurrentPerson返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆