Register Login

Keep Screen Stay Awake in Android App

Updated May 15, 2019

How to keep the screen on/ screen awake in Android Application.

This tutorial explains how to keep the screen on/ screen awake in Android Application. Sometimes when any application needs to wake up the screen or the CPU, therefore, needs to keep it awake to complete some work.

Please follow the steps below in order to keep the screen on/ screen awake Android application:

1.Open Android studio.

2.Go to MainActivity.java and add the code

getWindow(). addFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

3. By doing this, the display will never go off when your application is running in the device.


×