Turn off screen in Android emulator

I tried to test my application in the Android emulator, but could not test it if the screen is off (battery mode), but the application is still alive (perform some calculations), are there any flags for the emulator to emulate this behavior (screen is off )?

+4
source share
1 answer
private Window wind; wind = this.getWindow(); wind.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD); wind.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED); wind.addFlags(LayoutParams.FLAG_TURN_SCREEN_OFF); 

try it.

+2
source

Source: https://habr.com/ru/post/1383294/


All Articles