Reputation: 1
I am trying to add Gplus signin to my android app, but am having issues with Plus.PeopleApi.getCurrentPerson
. It always returns null on my device while testing the app. Here is how I am initializing googleclient and then trying to fetch user details from gplus.
google client
mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)) .build(); //
Connection & Disconnection
@Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); }
@Override protected void onStop() { super.onStop(); mGoogleApiClient.disconnect(); }
fetching user details
Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient); if (currentPerson != null) {
Please note that all the below possible causes are checked already and they are OK.
Upvotes: 0
Views: 237
Reputation: 1
ok i just found the solution, actually when the app is running in debug mode we have to create google-service.jason for SHA1 of debug.jks generated by android studio while building for debug mode.. no need to create your own keystone..copy SHA1 from Debug.keystore stored in /Users/"youruserfolder"/.android/debug.keystore and generate google-service.jason. Run the app and it works perfect :)
Upvotes: 0