Reputation: 4156
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?
Upvotes: 6
Views: 2141
Reputation: 544
it will work like a charm!!!
Upvotes: 1
Reputation: 3704
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.
Upvotes: 7