Android examples for User Interface:Screen Lock
is Screen Locked
//package com.java2s; import android.app.KeyguardManager; import android.content.Context; import android.os.PowerManager; public class Main { public static boolean isScreenLocked(Context context) { KeyguardManager mKeyguardManager = (KeyguardManager) context .getSystemService(Context.KEYGUARD_SERVICE); PowerManager pm = (PowerManager) context .getSystemService(Context.POWER_SERVICE); if (pm.isScreenOn() == false) { return true; } else {// w w w . j a va2s. c o m return mKeyguardManager.inKeyguardRestrictedInputMode(); } } }