mstoic
9/16/2018 - 6:43 PM

Detect if phone is locked

KeyguardManager myKM = (KeyguardManager) getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
if( myKM.inKeyguardRestrictedInputMode()) {
    // Phone is locked
    return;
}