0

Is there any way to force device not to sleep, if my app is shown on the screen? Does manifest.xml have a special attribute for this?

Tony
  • 3,605
  • 14
  • 52
  • 84

2 Answers2

0

Try this in your activity:

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

or use tag in manifest

android:keepScreenOn="true"

Read Android Documentation

Emil
  • 2,786
  • 20
  • 24
Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
0

add this tag to your manifest file under activity tag android:keepScreenOn="true"

shaikhmanzoor
  • 89
  • 1
  • 9