Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plus.PeopleApi.getCurrentPerson returns null

I am currently working on Google Plus log-in feature in my app.

I created GoogleApiClient builder like below

Plus.PlusOptions options = new Plus.PlusOptions.Builder()
            .addActivityTypes("http://schemas.google.com/AddActivity")
            .build();

    myGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            // .addApi(Plus.API, Plus.PlusOptions.builder().build())
            .addApi(Plus.API, options)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .addScope(Plus.SCOPE_PLUS_PROFILE).build();

And the onConnected method

@Override
public void onConnected(Bundle arg0) {
    // TODO Auto-generated method stub

    plusUtilities.ShowToast("Login successful");

    updateGPbutton();
    // hide progress DiaLog
    plusUtilities.DissmissPD();
    // it has deprecated
    // plusUtilities.ShowToast("Login to Google+ with " +
    // mPlusClient.getAccountName().toString());

    // upgraded class
    plusUtilities.ShowToast("Login to Google+ with "
            + Plus.AccountApi.getAccountName(myGoogleApiClient).toString());

    // deprecated
    // mPlusClient.loadPeople(this, "me");

    Plus.PeopleApi.load(myGoogleApiClient, "me");
    // plusUtilities.ShowPD("Fetching user data... ");

    // upgraded and call fetch_user_details method here instead of calling
    // in onPersonLoad() override method
    Log.d("Googleplusclient",
            "" + Plus.PeopleApi.getCurrentPerson(myGoogleApiClient));
    Plus.PeopleApi.loadVisible(myGoogleApiClient, null).setResultCallback(this);

    if (Plus.PeopleApi.getCurrentPerson(myGoogleApiClient) != null) {
        Person currentPerson = Plus.PeopleApi
                .getCurrentPerson(myGoogleApiClient);
        fetch_User_Details(currentPerson);
    }

}

The below method returns null

Plus.PeopleApi.getCurrentPerson(myGoogleApiClient)

I followed the the link for solution. Then I followed this developer link too. Till I am getting null value.

How to resolve this ?

like image 983
Karthikeyan Ve Avatar asked Nov 28 '14 15:11

Karthikeyan Ve


1 Answers

Well the thing is, your DEBUG sha1 signature is different then your customkey.keystore sha1 signature!!!! so you should find your debug sha1 signature and create that key on the API credentials on google console ASWELL ! :D this works and fixes it trust me, check your api console and i bet your api requests are 0?

like image 182
Sebastiaan van Dorst Avatar answered Nov 13 '22 07:11

Sebastiaan van Dorst