Why does blockingConnect method for GoogleApiClient return ConnectionResult.CANCELED?

Why does the blockingConnect method for GoogleApiClient return ConnectionResult.CANCELED, while during the same call I get ConnectionResult.SIGN_IN_REQUIRED from OnConnectionFailedListener?

I think the blockingConnect method should return the same ConnetionResult as in OnConnectionFailedListener.onConnectionFailed.

Is this a bug in GoogleApiClient?

Below is some sample code (should run on a background thread).

 GoogleApiClient googleApiClient = new GoogleApiClient.Builder(LoginActivity.this)
                        .addApi(Plus.API)
                        .addScope(Plus.SCOPE_PLUS_LOGIN)
                        .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
                            @Override
                            public void onConnectionFailed(ConnectionResult connectionResult) {

                            }
                        })
                        .build();
ConnectionResult connectionResult = googleApiClient.blockingConnect(30, TimeUnit.SECONDS);

      

I am using 'com.google.android.gms: play-services-plus: 7.3.0'

+3


source to share


1 answer


There was this problem too. This is what I hid so far. The blockingConnect method returns SUCCESS when you explicitly set the account name when creating your GoogleApiClient. Otherwise, it returns CANCELED. However, as nLL mentioned in the comment, blockingConnect returns SIGN_IN_REQUIRED in earlier versions of Play Services version 6.5.87, so you can try using that version.



+1


source







All Articles