简体   繁体   中英

Sign in with google plus in android app

I followed this https://developers.google.com/+/mobile/android/getting-started and this https://developers.google.com/+/mobile/android/people guide but still I am unable to get user data.

Current situation:
I press sign in button. That executes mGoogleApiClient.connect()
For first time it makes me choose google account.
After that onConnected method is called.

@Override
public void onConnected(Bundle bundle) {
    Log.d("asd", "connected");
    Plus.PeopleApi.loadVisible(mGoogleApiClient, null).setResultCallback(this);

    // After that  fetch data
    if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
        Person currentPerson = Plus.PeopleApi
                .getCurrentPerson(mGoogleApiClient);

        String personName = currentPerson.getDisplayName();
        Log.d("asd", "preson name " + personName);
    }
    mShouldResolve = false;
}

then onResult method is called

@Override
public void onResult(People.LoadPeopleResult result) {
    Log.d("asd", "result.getStatus():" + result.getStatus());
}

That prints out

result.getStatus():Status{statusCode=NETWORK_ERROR, resolution=null}

Why my Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) is always null?

I am using emulator with API 19 Google APIs and for certificate fingerprint I use debug SHA1

问题是清单中提供的软件包名称不正确。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM