Force Screen On – dont use WakeLock – use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) – Android sample

FLAG_KEEP_SCREEN_ON saving energy. Protects the battery if a user closing applications using the Return button on device. The device will returned to user screen mode settings.

@Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        //..........
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
This entry was posted in Android Examples Code and tagged , , . Bookmark the permalink.


Comments are closed.



10,602 views