Example usage for android.content Context KEYGUARD_SERVICE

List of usage examples for android.content Context KEYGUARD_SERVICE

Introduction

In this page you can find the example usage for android.content Context KEYGUARD_SERVICE.

Prototype

String KEYGUARD_SERVICE

To view the source code for android.content Context KEYGUARD_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.app.KeyguardManager for controlling keyguard.

Usage

From source file:Main.java

public static boolean isScreenLock(Context context) {
    KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return km.inKeyguardRestrictedInputMode();
}

From source file:Main.java

public static boolean haveLockScreen(Context context) {
    KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return km.inKeyguardRestrictedInputMode();
}

From source file:Main.java

public static boolean isSleeping(Context context) {
    KeyguardManager kgMgr = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return kgMgr.inKeyguardRestrictedInputMode();
}

From source file:Main.java

public static boolean isSleeping(Context context) {
    KeyguardManager kgMgr = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    boolean isSleeping = kgMgr.inKeyguardRestrictedInputMode();
    return isSleeping;
}

From source file:Main.java

public static boolean isScreenLocked(Context context) {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return keyguardManager.isKeyguardLocked();
}

From source file:Main.java

public static boolean isScreenLocked(Context context) {
    KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return mKeyguardManager.inKeyguardRestrictedInputMode();
}

From source file:Main.java

public static boolean inKeyguardRestrictedInputMode(Context context) {
    KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    return mKeyguardManager.inKeyguardRestrictedInputMode();
}

From source file:Main.java

public static void disLock(Context context) {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("");
    keyguardLock.disableKeyguard();//from  ww w  .j  a  v a2 s. c om

}

From source file:Main.java

private static boolean isScreenOffOrLocked(Context context) {
    KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    boolean off = !powerManager.isScreenOn();
    off |= keyguardManager.inKeyguardRestrictedInputMode();
    return off;// w  ww .  ja  va  2s .  co m
}

From source file:Main.java

public static KeyguardLock disableKeyguard(Context context) {
    KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    KeyguardLock mKeyguardLock = mKeyguardManager.newKeyguardLock("");
    mKeyguardLock.disableKeyguard();/*from www . ja v a2s  .  c om*/
    return mKeyguardLock;
}