简体   繁体   中英

FLAG_KEEP_SCREEN_ON does not work during keygaurd lock

Hi I am an Android newbie, I want to create an app which stays displayed even if the power button is pressed, I used,

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

but I had to press power button again to display the app, someone suggested me to use,

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

but it doesn't seem to work. Is there any work around ?

You can't prevent hardware keys overriding. Power button works on hardware level. Ur app will be unable to turn screen on after it was turned off by hardware.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM