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,337
  • 14
  • 47
  • 83

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,745
  • 19
  • 24
Misha Akopov
  • 11,071
  • 26
  • 66
  • 81
0

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

shaikhmanzoor
  • 104
  • 1
  • 9