Last active
August 29, 2015 14:06
-
-
Save zxx/d5208c50c23574293a50 to your computer and use it in GitHub Desktop.
Turn screen on / Keep screen on / Disable keyguard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only keep screen on | |
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | |
// disable KeyGuard and turn screen on | |
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); | |
// disable KeyGuard then turn screen on and keep screen on | |
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment