How to keep screen from dimming or sleeping in Android?

In order for your application screen need s to keep the screen from dimming or the processor from sleeping, you must request this permission.

<uses-permission android:name=”android.permission.WAKE_LOCK” />

Specifically if you have a scenario where in Audio is being played using the MediaPlayer and you are invoking the MediaPlayer.setScreenOnWhilePlaying() or MediaPlayer.setWakeMode() methods, then you would have to request the permission in Android Manifest file else it would not work.