即使活动失去焦点

即使活动失去焦点

本文介绍了如何保持用户在游戏室,即使活动失去焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户关闭屏幕球员离开房间,并在当它打开的屏幕后面的用户重新登录默认情况下,我伸出BaseGameActivity,我开始快速的游戏onSignInSucceeded。我想保持游戏的用户即使屏幕闭合时,接到一个电话,等等。

By default when the user closes screen player leaves the room and when it opens the screen back user logs back in. I am extending BaseGameActivity and I start quick game on onSignInSucceeded. I want to keep the user in game even if the screen is closed, received a call etc.

1。我怎样才能达到理想的行为?

1 . How can I achieve the desired behaviour?

2。我是不是错误配置的东西吗?

2 . Am I misconfiguring something?

3。这是的方式,因为GameHelper写?我应该重新实现它?

3 . Is this because of the way GameHelper is written? should I reimplement it?

推荐答案

目前,你不能让游戏运行,如果该活动失去焦点。此限制是内心深处的API中,而不是在GameHelper。我们可能会或可能不会改变未来,但现在没有办法实现这种行为。该建议呼吁leaveRoom()上的onStop(),以确保正确的清除。

Currently, you cannot keep the game running if the Activity loses focus. This restriction is deep down in the API, not in GameHelper. We may or may not change in the future, but for now there is no way to achieve that behavior. The recommendation is calling leaveRoom() on onStop() to ensure proper cleanup.

这篇关于如何保持用户在游戏室,即使活动失去焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 12:18