谷歌Play游戏服务+ BaseGameUtils:自动登录的第二个活动? [英] Google Play Game Services + BaseGameUtils: Automated sign-in in second Activity?
问题描述
在我的游戏的主菜单中,我为用户提供的可能性通过Google+登录(使用基于TypeANumber样本的谷歌Play游戏服务)。这工作得很好。然后,用户玩游戏,并且是针对我的末日轮式屏幕,这是另一项活动。在该活动中,我想保存用户的比分谷歌Play游戏服务,但 isSignedIn()
返回false。什么是重新建立在这个新的活动,以谷歌Play游戏服务的连接建议的方法?该BaseGameUtils图书馆不提供SilentReconnect - 方法。
In my game's main menu, I offer the user the possibility to sign in via Google+ (using the Google Play Games Services based on the TypeANumber-sample). This works fine. The user then plays the game, and is directed to my "End Round"-screen, which is another activity. In this activity, I'd like to save the user's score to Google Play Games Services, but isSignedIn()
returns false. What is the recommended approach to re-establish a connection to Google Play Games Services in this new activity? The BaseGameUtils-Library doesn't offer a "SilentReconnect"-Method.
我的第一个想法是更新布尔在本地应用程序设置,一旦用户登录/退出的主要活动,然后调用<$ C usesGooglePlus
-variable $ C> beginUserInitiatedSignIn(); 在我EndRound活动(如 usesGooglePlus
为真),但这种不健全的权利。有没有更好的方式来重新建立连接/获取GamesClient的?
My first idea would be updating a boolean usesGooglePlus
-variable in the local app settings once the user signs in/out on the main activity, and then calling beginUserInitiatedSignIn();
in my EndRound-activity (if usesGooglePlus
is true), but this doesn't sound "right". Is there a better way to re-establish the connection/get the GamesClient?
谢谢!
Thanks!
推荐答案
我重读的文件并似乎EndRound活动也应延长 BaseGameActivity
这样的连接自动建立在在onStart()
和评分可以再经过 onSignInSucceeded()
被调用。提交
I re-read the documentation and it seems that the EndRound-activity should also extend BaseGameActivity
so that the connection is automatically established in onStart()
and the score can then be submitted after onSignInSucceeded()
has been called.
这篇关于谷歌Play游戏服务+ BaseGameUtils:自动登录的第二个活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!