Google Android People错误状态{statusCode = NETWORK_ERROR,resolution = null}

时间:2016-08-26 20:50:30

标签: android google-plus google-signin signing google-people

美好的一天。我正在尝试调用api方法。一切顺利,登录屏幕正在向用户表示其圈子的请求,并且一旦我试图从圆圈中获取人员列表就会热潮总是有错误!

Status{statusCode=NETWORK_ERROR, resolution=null}

我不知道它造成了什么,通过谷歌搜索我发现没有什么更接近我的问题所以生病的代码我怎么称呼这个方法。 在这里我如何构建和称呼它。

 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;
}

它总是进入onFailure回调网络错误..我不知道我输入的错误是什么... 这是清单

中需要的权限
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />

所以请告诉我我的代码有什么问题吗?

1 个答案:

答案 0 :(得分:0)

如果有人在这里遇到同样的问题,那就是解决方案。你不需要指定&#34; me&#34;获得圈子时,同时像这样指定NULL

$('.container').on('scroll', function() {
  var scrollTop = $(this).scrollTop();
  $('.overlay').css('top', scrollTop);
  $('.overlay').css('bottom', -scrollTop);
});