谷歌玩游戏服务:奇怪的标志行为 [英] Google Play Game Services: strange sign in behavior

查看:147
本文介绍了谷歌玩游戏服务:奇怪的标志行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我已经添加了谷歌玩游戏服务支持我的应用程序(增加BaseGameActivity和GameHelper),并登录和注销工作流程正常工作。在我的图形线程我发送消息给主要活动的处理程序,它调用beginUserInitiatedSignIn或signOut。当识别完成后,游戏助手来电onSignInFailed或onSignInSucceeded我的活动,我可以检查isSignedIn(true,如果onSignInSucceeded叫)。

Recently I've added Google Play Game Services support in my app (added BaseGameActivity and GameHelper), and it sign-in and sign-out workflow worked fine. In my graphics thread I send message to main activity handler, it calls beginUserInitiatedSignIn or signOut. When identification process completes Game Helper calls onSignInFailed or onSignInSucceeded of my activity and I can check isSignedIn (true if onSignInSucceeded was called).

但今天我发现,它现在的行为很奇怪。可悲的是,我没有备份的最后一个工作版本,但essense code是相同的。

But today I've found that it behaves strange now. Sadly that I did not backup last working version, but the essense code is the same.

如果我要求的应用程序登录,这表明谷歌服务的登录对话框(我有2个帐户我的设备上)。我选择一个帐户,preSS确定,返回到我的应用程序,但没有onSignInSucceeded也不onSignInFailed被称为(previously如果我取消此对话框,我看到未知错误消息)。当我尝试登录在第二次它将启动一个旋转一圈,等待不休。如果我点击屏幕上它中止等待,并返回我的看法。

If I ask app to sign in it shows google services sign-in dialog (I have 2 accounts on my device). I choose an account, press ok, it returns to my app but neither onSignInSucceeded nor onSignInFailed is called (previously if I canceled this dialog I saw "unknown error" message). When I try to sign in in the second time it launches a rotating circle and waits endlessly. If I tap on screen it aborts waiting and returns to my view.

但如果我关闭该应用程序并再次启动它,这标志在发射成功后,打电话onSignSucceded并保持连接状态,当我检查的运行时间。它说:

ALTHOUGH if I close the app and launch it once again, it signs in on launch successfully, call onSignSucceded and stay connected when I check in runtime. It says:

onCreate: creating GamesClient
onStart.
onStart: connecting clients.
Connecting GamesClient.
onConnected: connected! client=1
All clients now connected. Sign-in successful.
All requested clients connected. Sign-in succeeded!

如果我注销,然后尝试再次登录,它表明帐户对话框,写道:

If I sign out and then try to sign in again, it shows accounts dialog and writes:

isGooglePlayServicesAvailable returned 0
beginUserInitiatedSignIn: starting new sign-in flow.
Connecting GamesClient.
onConnectionFailed: result 4
onConnectionFailed: since user initiated sign-in, trying to resolve problem.
resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41f8a610: android.os.BinderProxy@41f8a5b0}}
result has resolution. Starting it.

当我选择它返回到我的活动,并没有onSignInSucceeded也不onSignInFailed被称为一个帐户。如果我检查运行时我看到该应用程序未连接到Google服务。 当我尝试重新登录就显示永远旋转一圈,说:

When I choose an account it returns to my activity and neither onSignInSucceeded nor onSignInFailed is called. If I check in runtime I see that app is not connected to google services. When I try to sign in again it shows forever rotating circle and says:

isGooglePlayServicesAvailable returned 0
beginUserInitiatedSignIn: continuing pending sign-in flow.
resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41f8a610: android.os.BinderProxy@41f8a5b0}}
result has resolution. Starting it. 

当我点击屏幕,圈被中止而不调用onSignInSucceeded也不onSignInFailed等。

When I tap the screen, circle is aborted without calls to onSignInSucceeded nor onSignInFailed and so on.

我不能想象什么地方出了错。处理程序是在主线程创建的。我有谷歌为例,其招牌和标志出没有任何问题,就像我的应用程序一样。有谁能告诉什么可以是错误的?谢谢!

I can't imagine what went wrong. Handler is created on main thread. I have Google example, and it signs in and signs out without any problem, just like my app did. Can somebody tell what can be wrong? Thanks!

推荐答案

它花了2天才找到一个愚蠢的错误。当你扩展BaseGameActivity确保您调用它在您的活动方式的所有方法(如果你忽略他们),例如:

It took 2 days to find a silly mistake. When you extend BaseGameActivity make sure you call all its methods in your activity methods (if you override them), for example:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
 super.onActivityResult(requestCode, resultCode, data);
 ....
 <our code here>
}

BaseGameActivity调用其聚集mHelper的方法,它们做的所有魔法。

BaseGameActivity calls its aggregated mHelper's methods which do all the magic.

这篇关于谷歌玩游戏服务:奇怪的标志行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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