用户登出:清除默认谷歌帐户不会导致帐户选择器在Android应用中显示 [英] User Sign-out: clearing the default Google account does not cause the account picker to show up in Android app

查看:575
本文介绍了用户登出:清除默认谷歌帐户不会导致帐户选择器在Android应用中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也跟着下面的链接,在我的Andr​​oid应用程序,它使用谷歌API的客户实行注销按钮。然而,在重新连接谷歌的API,用户不是与帐户选择器psented $ P $。它看起来像她/他当初的选择是某种程度上或许仍缓存的价值。我一直在试图算出这个几个小时。

任何和所有的想法非常欢迎。谢谢你。

https://developers.google.com/+/mobile/android/签到

 如果(mGoogleApiClient.isConnected()){
  Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
  mGoogleApiClient.disconnect();
}


解决方案

我已经使用clearDefaultAccount并尝试重新连接,以及很多问题。最后,我决定使用的 AccountPicker 类(其中,顺便说一句,不要求清单全局权限)。

所以,当用户要连接,总是显示AccountPicker,然后使用所选的帐户建立你GoogleApiClient(见.setAccountName在<一个href=\"https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html\"相对=nofollow> GoogleApiClient.Builder )。

现在一切工程进展顺利。

I followed the below link to implement a "sign out" button in my android app, which uses a Google API client. However, upon connecting the google api again, the user is not presented with an account picker. It looks like the value of her/his original choice is somehow still cached perhaps. I've been trying to figure this out for a few hours.

Any and all ideas very welcome. Thank you.

https://developers.google.com/+/mobile/android/sign-in

if (mGoogleApiClient.isConnected()) {
  Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
  mGoogleApiClient.disconnect();
}

解决方案

I've had many problems using clearDefaultAccount and trying to reconnect as well. Finally I've decided to separate the account selection process by using the AccountPicker class (which, by the way, doesn't require global permissions in manifest).

So, when the user wants to connect, always show the AccountPicker and then use the selected account to build your GoogleApiClient (see .setAccountName in GoogleApiClient.Builder).

Everything works smoothly now.

这篇关于用户登出:清除默认谷歌帐户不会导致帐户选择器在Android应用中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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