To keep the screen from turning off, call the turnOn method of the KeepScreenOn class . Calling the turnOff method of the KeepScreenOn class will restore the screen to turn off automatically. Alternatively, you can do the same by specifying false as the argument to the turnOn method.
Read more