Plus.PeopleApi can not connect

1

I'm developing an application that will create, read, and update some documents in Drive .

In NavigationView , I would like to identify the User account. The same way it is done in the Google Play or Play Music app.

To do this, I added / enabled the Google+ API and tried to collect the information as follows:

mClient = new GoogleApiClient.Builder(this).enableAutoManage(this, this).addApi(Drive.API).addApi(Plus.API).addScope(Drive.SCOPE_FILE).addScope(new Scope(Scopes.PLUS_ME)).addScope(new Scope(Scopes.PLUS_ME)).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();

@Override
public void onConnected(@Nullable Bundle bundle) {
    connectPeople();
}

private void connectPeople(){
    final PendingResult<People.LoadPeopleResult> people = Plus.PeopleApi.loadVisible(mClient, null);
    people.setResultCallback(new ResultCallback<People.LoadPeopleResult>() {
        @Override
        public void onResult(@NonNull People.LoadPeopleResult peopleData) {
            if (peopleData.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
                PersonBuffer personBuffer = peopleData.getPersonBuffer();
                try {
                    int count = personBuffer.getCount();
                    for (int i = 0; i < count; i++) {
                        Log.d("PEOPLE" , "Display name: " + personBuffer.get(i).getDisplayName());
                    }
                } finally {
                    personBuffer.release();
                }
            } else {
                Log.e("ERROR RRRR", peopleData.getStatus().toString());
                Toast.makeText(getApplicationContext(), "No connect: "+peopleData.getStatus().toString(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(this, RESOLVE_CONNECTION_REQUEST_CODE);
        } catch (IntentSender.SendIntentException e) {
        }
    } else {
        Toast.makeText(this, connectionResult.getErrorMessage(), Toast.LENGTH_LONG).show();
    }
}

Permissions:

android:name="android.permission.INTERNET"
 android:name="android.permission.USE_CREDENTIALS" 
 android:name="android.permission.GET_ACCOUNTS" 
 android:name="android.permission.READ_PROFILE"
 android:name="android.permission.ACCESS_NETWORK_STATE"
 android:name="android.permission.AUTHENTICATE_ACCOUNTS"
 android:name="android.permission.GET_ACCOUNTS"
 android:name="android.permission.ACCESS_FINE_LOCATION" 
 android:name="android.permission.ACCESS_COARSE_LOCATION" 

I added the Api's and created the key.

I added the file google-services.json

And I added the string google_app_id

Every time I make the request the following error occurs:

  

RRRR E / ERROR: Status {statusCode = NETWORK_ERROR, resolution = null}

Does anyone know what it can be?

    
asked by anonymous 09.03.2016 / 20:40

0 answers