List of usage examples for android.content Context KEYGUARD_SERVICE
String KEYGUARD_SERVICE
To view the source code for android.content Context KEYGUARD_SERVICE.
Click Source Link
From source file:org.cryptsecure.Utility.java
/** * Checks if is screen locked.//w ww. j a v a 2s.c o m * * @param context * the context * @return true, if is screen locked */ public static boolean isScreenLocked(Context context) { KeyguardManager myKM = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); if (myKM.inKeyguardRestrictedInputMode()) { // it is locked return true; } else { // it is not locked return false; } }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
static final private boolean isKeyguardEffective(Context mContext) { KeyguardManager keyguardMgr = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); boolean result = keyguardMgr.inKeyguardRestrictedInputMode(); return result; }