Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Plus getCurrentPerson returns null

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

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

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

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

SHA1 fingerprint from Eclipse ADT SHA1 fingerprint from Eclipse ADT

Client ID for installed applications Client ID for installed applications

Simple API access Simple API access

like image 257
Zbarcea Christian Avatar asked Dec 12 '13 21:12

Zbarcea Christian


1 Answers

In my case I forgot to enable permission for google-plus

Hope it works...Any doubt let me know

Check from scratch:

Sometime person info may be null

check : PERMISSIONS

Important things to do:

Enable Google plus API

Enable Google Maps Android API

If you test locally then add sha1 key in eclipse-->window-->preference option-->Android-->Build

OR

You can generate SHA1 key through command prompt

keytool -list -v -keystore "C:\Users\User.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

If you are publishing app in play-store then you need to change SHA1 key in google console

because in local SHA1 key is different . After doing signedApk SHA1 key is different

While generating signed apk -->in the last screen -->you can see SHA1 key

After adding in google console you will get API key

Add this key in Manifest file

enter image description here

like image 166
madhu527 Avatar answered Sep 27 '22 17:09

madhu527