Android / Libgdx: multitasking button detection

I use Libgdx to develop a game for Android, and I noticed that when I click on the multitasking button while I am looking at a list of previous applications, the game is still running in the background (I see that the game continues to move in the background). Obviously, I would like to pause the game.

I use the Screen class, and the pause () method seems to be called only when the application changes efficiently. I was not able to detect the button click event as a workaround.

Thank you for your help.

+4
source share
1 answer

Whether pause() is called in this scenario depends on the device / OS.

The key key you want to listen to is KEYCODE_APP_SWITCH . If this does not work with the InputAdapter (I don’t know the associated Keys value, if it even exists), then you need to look in gdx and understand why it does not pass.

+2
source

Source: https://habr.com/ru/post/1443180/


All Articles