In Play Services 6.1.71 I was using:
mPlusClient = new PlusClient.Builder(this,this,this).setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity").setScopes(Scopes.PLUS_LOGIN, Scopes.PROFILE).build();
But in Google Play Services 6.5.87, Google suggest to change PlusClient to GoogleApiClient.Builder instead. But I'm not able to get user info as before:
mPlusClient.getAccountName()
or
mPlusClient.getCurrentPerson()
How can I retrieve the user info? I think Google documentation is out of date. Hope you can help me. Thank you.
You can use the GoogleApiClient ("Google API Client") object to access the Google APIs provided in the Google Play services library (such as Google Sign-In, Games, and Drive).
To update Google Play Services on your Android device, head to the "Apps & Notifications" menu in your settings. Google Play Services let your Android apps connect to the internet and communicate with Google. Updating Google Play Services can fix app issues, and help your Android device run faster.
Use GoogleApiClient, not PlusClient. Sample:
mGoogleApiClient = new GoogleApiClient.Builder(mContext)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
To getAccountName() use Plus.AccountApi.getAccountName(mGoogleApiClient)
To getCurrentPerson() use Plus.PeopleApi.getCurrentPerson(mGoogleApiClient)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With