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 moreWhat is Wakelock?
A wake lock is a mechanism to indicate that your application needs to have the device stay on . Any application using a WakeLock must request the android. permission.
Read more