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?
Asked
Active
Viewed 81 times
2 Answers
0
Try this in your activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
or use tag in manifest
android:keepScreenOn="true"

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