Android Question Detecting screen unlock method

Alessandro71

Well-Known Member
Licensed User
Longtime User
Phones can be unlocked in several ways:
  • PIN
  • Pattern
  • Fingerprint
  • Face
Is there a way to trap the unlock event and check which method has been used?
 

Sandman

Expert
Licensed User
Longtime User
Security logic would dictate that a standard app can't. Might be different answer if the phone is rooted or if it's a kiosk app.
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
Security logic would dictate that a standard app can't. Might be different answer if the phone is rooted or if it's a kiosk app.
I'm not asking for way to unlock a locked phone, nor the PIN used for it; just a notification of an successful unlock and by which method.
I see no security compromise in that.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
I'm not asking for way to unlock a locked phone, nor the PIN used for it; just a notification of an successful unlock and by which method.
Yes, that's how I understood your question.


I see no security compromise in that.
If an app could know your method of unlocking, it would be possible to put up a fake lock screen that wouldn't be suspicious to the user and then record their unlocking response. And just like that you would have the users password (or pin, etc). I'd call that a pretty big security problem.
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
That’s not the purpose of my question, rather than increasing device security:
once you have set your device for fingerprint or face authentication, you should also set a PIN for emergency unlock.
this is also means that an attacker could also unlock the phone by using the PIN, that can be easily eavesdropped.
by logging the unlock type of the device, the legitimate owner can check if his device has been unlocked by a different method from the one he’s normally using.
but this can be done only if you can retrieve the unlock method that’s just been used.
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
take a look here:


There seems to be an event when the device is unlocked but not the type of unlock. It may be in the documentation and I missed it.

You should be able to use this library to setup the broadcast receiver.

My phone has a fingerprint senor which I always use, but forces me to enter the backup code every 72 hours, presumably to make sure I don't forget it.
 
Upvote 0
Top