Logout for GoogleApiClient in Android application

后端 未结 4 414
日久生厌
日久生厌 2020-12-21 02:48

Using such code it is possible to link my app and use account.

if (mGoogleApiClient == null) {
            mGoogleApiClient = new GoogleApiClient.Builder(thi         


        
4条回答
  •  -上瘾入骨i
    2020-12-21 03:42

    I found this up-to-date solution:

    if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
                            mGoogleApiClient.clearDefaultAccountAndReconnect().setResultCallback(new ResultCallback() {
    
                                @Override
                                public void onResult(Status status) {
    
                                    mGoogleApiClient.disconnect();
                                }
                            });
    
                        }  
    

    The usage of

    Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
    

    is deprecated

    https://developers.google.com/android/reference/com/google/android/gms/plus/Account

提交回复
热议问题