Day 3: Enabling immersive mode on Android
While testing the math from my previous post, I noticed that wrong set of images gets picked up on some of the Android devices. Those devices have on-screen buttons (home, back, menu) which are shown inside the screen. Luckly, the solution is simple, just enable the immersive mode and buttons would go away and you have the whole screen to your game.
As a side-effect, players would be much less likely to hit the home button at the bottom of the screen and exit your game mid-play, as they would have to drag the finger to make the button appear at all.
The immersive mode is available since KitKat. If you don’t want to bother with the docs, here’s the code you can simply copy/paste into your project:
http://bigosaur.com/blog/32-handle-immersive-kitkat
The code uses a 5 second delay before immersive mode is activated. This is useful in case user lanuches the app by mistake.
If you’re making an Android game, please implement this.