Good day.I am trying to call the api method.All goes good,the screen of login is being represented to user with request of its circles,and boom as soon as im trying to get the people list from circles it goes with error always!
Status{statusCode=NETWORK_ERROR, resolution=null}
I dont know what it causing and by googling i found nothing closer to my issue so ill post an code how i do call this method. Here how i build and call it.
public synchronized GoogleApiClient buildGoogleApiClient(final Activity activity) {
GoogleSignInOptions gGoogleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(new Scope(Scopes.PROFILE))
.requestScopes(new Scope(Scopes.PLUS_LOGIN))
.requestProfile()
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(activity)
.addApi(Auth.GOOGLE_SIGN_IN_API, gGoogleSignInOptions)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(@Nullable Bundle bundle) {
Plus.PeopleApi.loadVisible(mGoogleApiClient, "me").setResultCallback(new ResultCallbacks<People.LoadPeopleResult>() {
@Override
public void onSuccess(@NonNull People.LoadPeopleResult loadPeopleResult) {
Toast.makeText(activity, "", Toast.LENGTH_SHORT).show();
Person person = loadPeopleResult.getPersonBuffer().get(0);
Log.d("fasfafasfsafasfas", "onSuccess: " + person);
}
@Override
public void onFailure(@NonNull Status status) {
if (status.hasResolution()) {
try {
// !!!
status.startResolutionForResult(activity, 100);
} catch (IntentSender.SendIntentException e) {
mGoogleApiClient.connect();
}
}
Log.d("fasfafasfsafasfas", "onFailure: " + status);
}
});
}
@Override
public void onConnectionSuspended(int i) {
Toast.makeText(activity, "fail", Toast.LENGTH_SHORT).show();
}
})
.addApi(Plus.API)
.build();
mGoogleApiClient.connect(GoogleApiClient.SIGN_IN_MODE_OPTIONAL);
return mGoogleApiClient;
}
It always goes into onFailure callback with network error..I dont know whats wrong i have typed... here is permissions required in manifest
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
So please do tell me whats wrong with my code?