简体   繁体   English

android-从Android应用程序中的Google集成注销

[英]android - log out from Google integration in android app

I am signing out from google integration by following: 我正在通过以下方式从Google集成中注销:

 Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
                               new ResultCallback<Status>() {
                                   @Override
                                   public void onResult(Status status) {
                                       AndyConstants.loginorout = false;
                                       Intent intent = new Intent(getActivity(), HomeActivity.class);
                                       startActivity(intent);
                                   }
                               });

now the problem is that in onResult() I am starting activity named HomeAvtivity but after signing out i am redirected to an activity(RegisterActivity) where google login button is present instead of HomeActivity 现在的问题是,在onResult()我正在启动名为HomeAvtivity的活动,但是退出后,我将重定向到存在Google登录按钮而不是HomeActivity的活动(RegisterActivity)

I have found the solution that I was not connecting GoogleApiClient in onResume() and thus it was crashing because GoogleApiClient was null. 我发现我没有在onResume()连接GoogleApiClient的解决方案,因此由于GoogleApiClient为null而崩溃。 So just add following to your code and above function will log out user from google integration successfully. 因此,只需将以下内容添加到您的代码中,以上功能将成功从Google集成中注销用户。

 @Override
    protected void onStart() {
        super.onStart();
        mGoogleApiClient.connect();
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM