Lay'O
Lay'O

Reputation: 57

Detect unlock screen type on Android

Is there a way to detect how actually user unlock phone? - via PIN or pattern or using swipe gesture I've googled only smth about registering Receiver with this code in onReceive()

KeyguardManager keyguardManager = 
            (KeyguardManager)context.getSystemService(Context.KEYGUARD_SERVICE);
        if (keyguardManager.isKeyguardSecure())

Upvotes: 0

Views: 279

Answers (1)

Arthur Attout
Arthur Attout

Reputation: 2916

Since the Settings.Secure.getLong method is deprecated since API level 23, and that it has been replaced by the KeyGuardManager, it doesn't seem possible to retrieve the exact lock type.

As you've found out, using isDeviceSecure() is the closest information you can retrieve.

Upvotes: 2

Related Questions