简体   繁体   English

在Android中开发实时多人游戏

[英]Developing a Real-time Multiplayer Game in Android

I am facing problem in signing in using the google real time muleiplayer api's even after following all steps throughly as given in the documentation. 即使按照文档中给出的所有步骤进行操作,我仍然在使用Google实时muleiplayer api登录时遇到问题。 Following is the link from where I have referred: https://developers.google.com/games/services/android/init . 以下是我引荐的链接: https : //developers.google.com/games/services/android/init I am not getting any error but my main activity extends BaseGameActivity when i start my game it calls onSignInFailed() automatically but i am calling the beginUserInitiatedSignIn() method from BaseGameActivity which is used for initialization of sign in on the button click none of the overridden methods gets called not even onSignInFailed() nor onConnectionFailed() . 我没有收到任何错误,但是我的main activity extends BaseGameActivity在我启动游戏时main activity extends BaseGameActivity ,它会自动调用onSignInFailed()但是我正在从BaseGameActivity调用beginUserInitiatedSignIn()方法,该方法用于初始化按钮上的登录,请单击未覆盖的任何内容甚至onSignInFailed()调用onSignInFailed()onConnectionFailed()

It's normal for it to call onSignInFailed on startup if have never signed in before. 如果以前从未登录过,则在启动时调用onSignInFailed是很正常的。 That's working as intended. 这按预期工作。 Then, you should call beginUserInitiatedSignIn when your button is clicked, and then either onSignInFailed on onSignInSucceeded should be called. 然后,应在单击按钮时调用beginUserInitiatedSignIn ,然后应调用onSignInFailed上的onSignInSucceeded

I'd suggest putting some print statements around your code and BaseGameActivity to figure out what methods are being called to figure out what's happening. 我建议在您的代码和BaseGameActivity周围放一些打印语句,以找出正在调用的方法以找出正在发生的情况。

By the way, the most common cause for sign-in errors is having a Client ID that's incorrectly set up. 顺便说一下,导致登录错误的最常见原因是客户端ID设置不正确。 I'd recommend taking a look at the troubleshooting guide to see if there is a problem with your setup: 建议您查看故障排除指南,以了解您的设置是否存在问题:

https://developers.google.com/games/services/android/troubleshooting https://developers.google.com/games/services/android/troubleshooting

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM