Example usage for android.os PowerManager FULL_WAKE_LOCK

List of usage examples for android.os PowerManager FULL_WAKE_LOCK

Introduction

In this page you can find the example usage for android.os PowerManager FULL_WAKE_LOCK.

Prototype

int FULL_WAKE_LOCK

To view the source code for android.os PowerManager FULL_WAKE_LOCK.

Click Source Link

Document

Wake lock level: Ensures that the screen and keyboard backlight are on at full brightness.

Usage

From source file:com.plusot.senselib.SenseMain.java

@SuppressWarnings("deprecation")
private void unlockScreen() {
    if (Globals.testing.isVerbose())
        LLog.d(Globals.TAG, CLASSTAG + ".unLockScreen");
    getWindow().addFlags(//from   www .  ja va2s .co m
            WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    final PowerManager.WakeLock wl = pm.newWakeLock(
            (PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE),
            Globals.TAG + "_WakeLock2");
    wl.acquire();
    new SleepAndWake(new SleepAndWake.Listener() {
        @Override
        public void onWake() {
            wl.release();
        }
    }, 2000);

}