Unlock and wake the screen up - Android User Interface

Android examples for User Interface:Screen Lock

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  va2  s . com
}

Related Tutorials