Unlock and wake the screen up - Android Phone

Android examples for Phone:Screen

Description

Unlock and wake the screen up

Demo Code


//package com.java2s;
import android.app.Activity;

import android.view.Window;
import android.view.WindowManager;

public class Main {
    /** Unlock and wake the screen up  */
    public static void unlockScreen(Activity activity) {
        Window window = activity.getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
        window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
        window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    }/*from ww  w. ja  va  2  s  . co  m*/
}

Related Tutorials