谷歌游戏服务登录回调函数

4
我尝试在我的cocos2d-x游戏中设置Google Play游戏服务。为此,我使用了BaseGameActivity.java和GameHelper.java文件,因此我的主类继承自BaseGameActivity。 当我调用mHelper.beginUserInitiatedSignIn()时,它会显示Google Play活动,然后隐藏它。但是回调(onSignInSucceeded和onSignInFailed)没有被调用。当我尝试再次调用mHelper.beginUserInitiatedSignIn()时,它会发送消息“GameHelper WARNING:beginUserInitiatedSignIn()在已连接时被调用...”。
!!! GameHelper WARNING: beginUserInitiatedSignIn() called when already connecting. Be patient! You can only call this method after you get an onSignInSucceeded() or onSignInFailed() callback. Suggestion: disable the sign-in button on startup and also when it's clicked, and re-enable when you get the callback.

你确定已经通过将你的GameHelperListener提供给mHelper.setup(listener)来设置GameHelper了吗? - Paul Lammertsma
也许它可以帮助我? BaseGameActivity(4397): GameHelper: 连接失败 BaseGameActivity(4397): GameHelper: 连接失败: BaseGameActivity(4397): GameHelper: - 代码:SIGN_IN_REQUIRED(4) BaseGameActivity(4397): GameHelper: - 可解决:true BaseGameActivity(4397): GameHelper: - 详细信息:ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{419d9b58: android.os.BinderProxy@41a08768}} BaseGameActivity(4397): GameHelper: onConnectionFailed: 因为用户发起了登录,正在解决问题。 - Kikiki
2个回答

2

Google Play游戏服务:奇怪的登录行为

super.onActivityResult(requestCode, resultCode, data);

(说明:该代码是在Android开发中使用Google Play游戏服务时,处理登录结果时需要调用的方法之一。)

啊,是的,这很有道理。BaseGameActivity负责处理结果,因此如果您在不将未处理的requestCodes传递到super的情况下覆盖它,您将有效地破坏流程。 - Paul Lammertsma

0

这个问题也是由于游戏服务处于测试模式(而不是发布模式)引起的,因此请将您的用户添加到测试人员中。

在发布应用程序后,开发人员需要将发布SHA1(发布管理>>应用签名,如果您在发布时选择了谷歌签名应用程序)添加到https://console.developers.google.com/下的应用凭据中。

应使用Google应用签名SHA1,而不是从本地PC生成的SHA1<< 这就是我连续两天遇到的问题。

希望这能帮助到某些人。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接