android – Google Play游戏 – 自动调用beginUserInitiatedSignIn()的Activity

我最近在我的应用中更新了Google Play服务库,以使用新的Google Api.这样,每当我第一次启动一个Activity(它扩展BaseGameActivity)而没有登录时,Activity会自动出现登录对话框.

我没有在任何地方进行任何beginUserInitiatedSignIn()调用.这很烦人 – 这有什么办法吗?

这是一个logcat:

03-02 21:13:08.067: W/PopupManager(12332): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
03-02 21:13:08.137: D/dalvikvm(12332): GC_FOR_ALLOC freed 223K,3% free 9306K/9560K,paused 16ms,total 16ms
03-02 21:13:08.197: I/Adreno-EGL(12332): glrenderer(12332): Enabling debug mode 0
03-02 21:13:39.771: W/PopupManager(12432): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
03-02 21:13:39.891: D/dalvikvm(12432): GC_FOR_ALLOC freed 227K,3% free 9303K/9560K,paused 17ms,total 17ms
最佳答案
这是认行为,根据this issue.

FAQ指出:

[4] Why is GameHelper/BaseGameActivity attempting to sign in on
application startup?

The default behavior of BaseGameActivity and GameHelper is to show the user
the sign-in flow (consent dialogs,etc) as soon as your application starts.
Naturally,once the user signs in for the first time,they won’t see the
consent flow again,so it will be a seamless experience. It is important
for the user to sign in as early as possible so your application can take
advantage of the Google Play Games API right away (for example,saving the
user’s progress using Cloud Save,unlocking achievements,etc). If the user
cancels the sign-in flow,BaseGameAcitivity/GameHelper will remember that
cancellation. If the total number of cancellations reaches a predefined
maximum (by default,3),the user will no longer be prompted to sign in on
application startup. If that happens,they can still sign in by clicking
your application’s Sign In button,if you provide one.

[5] I don’t like the new “auto sign in” feature of GameHelper. How can
I disable it?

To disable this feature and return to the old behavior,you can edit
GameHelper.java and set the DEFAULT_MAX_SIGN_IN_ATTEMPTS constant to 0,or
call GameHelper.setMaxAutoSignInAttempts(0) at runtime,before calling
GameHelper.setup() (or,correspondingly,from your Activity’s onCreate
method).

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...