Android应用中的谷歌+集成注销问题

时间:2016-06-28 04:55:09

标签: java android

我已在我的Android应用中集成了google +,它与google +连接并获取信息,但在退出时它会自动登录。我发现在注销之前检查条件googleApiClient.isConnected()时会返回false。怎么解决这个问题?

private void gPlusSignIn() {
    if (!googleApiClient.isConnecting()) {
        Log.d("user connected","connected");
        isSignInBtnClicked = true;
        progressDialog.show(thisActivity, "Please Wait",
                "Loading...", true);
        resolveSignInError();
    }
}


private void resolveSignInError() {
    if (connectionResult.hasResolution()) {
        try {
            isIntentInProgress = true;
            connectionResult.startResolutionForResult(thisActivity, SIGN_IN_CODE);
            Log.d("resolve error", "sign in error resolved");
        } catch (IntentSender.SendIntentException e) {
            isIntentInProgress = false;
            googleApiClient.connect();
        }
    }
}


public static void gPlusSignOut() {
    if (googleApiClient.isConnected()) {
        Plus.AccountApi.clearDefaultAccount(googleApiClient);
        googleApiClient.disconnect();
        isSignInBtnClicked = false;
        Log.d("user Disconnected","Disconnected");
       //  googleApiClient.connect();
      //  changeUI(false);
    }
}

0 个答案:

没有答案