Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google+ Platform for Android - getCurrentPerson

Tags:

android

I use the Google+ Platform for Android with

PlusClient plusClient = 
  new PlusClient.Builder(this, this, this).setScopes(Scopes.PLUS_LOGIN).build();

In the onConnected-Listener I want to read the data of the logged in user

@Override
public void onConnected() {
  super.onConnected();    
  Person person = plusClient.getCurrentPerson();
}

The method call getCurrentPerson returns null. Has anyone managed to read the user-data?

like image 438
ZehnVon12 Avatar asked Feb 28 '13 12:02

ZehnVon12


2 Answers

You need to create an OAuth 2 client ID and add your Android app's developer (and probably production) signing keys to it, as described in the Google+ Getting Started guide.

I did the same thing but had not known to create the OAuth 2 client ID, and was getting null from that method (of course with no useful feedback in the logs). After creating the ID and adding my app's signing keys, the method returns an actual Person instance.

Even though you don't actually USE the client ID anywhere in your application, the act of adding your signing key in that interface apparently unlocks something on Google's servers and allows things to work.

like image 200
samskivert Avatar answered Sep 21 '22 12:09

samskivert


Did you go through the setup steps outlined here?

like image 44
Silvano Avatar answered Sep 22 '22 12:09

Silvano