In the previous section we added the accelerometer interaction to our game, which means that our player is controlling the main character by moving the phone rather than by touching the screen, this will cause many android devices to turn off the screen after a period of inactivity (not touching the screen). Of course, no one would like that our Android device's screen suddenly goes black; in order to prevent this from happening, we will call the
setKeepScreenOnJni method, introduced in the previous version 3.3 of the framework. Prior to this version, this annoying situation was considered a framework flaw, and now it has finally been fixed.
We first need to include the helper in our
HelloWorldScene.cpp header file as follows: ...