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 . How can I achieve the desired behaviour?
2 . Am I misconfiguring something?
3 . Is this because of the way GameHelper is written? should I reimplement it?
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.
I remove gamehelper.onstop() in BaseGameActivity.onstop(), and it works.
来源:https://stackoverflow.com/questions/19100169/how-to-keep-user-in-the-game-room-even-if-activity-loses-focus