如何退出Google云端硬盘帐户? [英] How to sign out of a Google Drive account?

查看:2269
本文介绍了如何退出Google云端硬盘帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何注销Google云端硬盘服务?我不想切换帐户,但必须彻底登出。



我正在开发一款应用程序,该应用程序将使用用户的Google云端硬盘存储空间以及其他存储服务。因此,我需要允许用户退出Google Drive。

解决方案

撇开我认为这是一个糟糕的API实现,这是您如何注销。

  mGoogleApiClient.unregisterConnectionCallbacks(mConnectionCallbacksListener); 
mGoogleApiClient.unregisterConnectionFailedListener(mOnConnectionFailedListener);
mGoogleApiClient.clearDefaultAccountAndReconnect();

取消注册回调是为了避免API显示Google Account picker,换句话说,避免重新连接。请记住,如果您稍后要登录任何Google服务,请再次设置回调!



或者,您可以获取操作的结果:

$ b $ (新状态)b

  mGoogleApiClient.clearDefaultAccountAndReconnect()。setResultCallback(new ResultCallback< Status>(){
@Override
public void onResult {
//可选
}
});


How do I log out of the Google Drive service? I do not want to switch accounts but to log out definitively.

I am working on an app that will use the user's Google Drive storage among other storage services. Therefore I need to allow the user to sign out of Google Drive.

解决方案

Leaving aside I think this is a poor API implementation, this is how you log out.

mGoogleApiClient.unregisterConnectionCallbacks(mConnectionCallbacksListener);
mGoogleApiClient.unregisterConnectionFailedListener(mOnConnectionFailedListener);
mGoogleApiClient.clearDefaultAccountAndReconnect();

The unregistration of the callbacks is to avoid the API showing the Google Account picker, in other words, to avoid reconnecting. Remember to set the callbacks again if you are going to sign in to any Google service later!

Optionally, you can get the operation's result:

mGoogleApiClient.clearDefaultAccountAndReconnect().setResultCallback(new ResultCallback<Status>() {
        @Override
        public void onResult(Status status) {
            // Optional
        }
    });

这篇关于如何退出Google云端硬盘帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆