Reputation: 41
Unhappily I could not put a comment under an answer of What's the difference between isDeviceLocked and isKeyguardSecure in android's KeyguardManager?, but how so often I don't find a answer to my questions and have then dig through codesearch.
So back to the question:
What is the difference between:
((KeyguardManager)getSystemService(Context.KEYGUARD_MANAGER).isDeviceLocked()
and
((KeyguardManager)getSystemService(Context.KEYGUARD_MANAGER).isKeyguardLocked()
?
My target was to figure out if the device is in use or locked.
Upvotes: 1
Views: 913
Reputation: 41
((KeyguardManager)getSystemService(Context.KEYGUARD_MANAGER).isDeviceLocked()
Gives you a true if user has set a lockscreen other then None or Swipe.
((KeyguardManager)getSystemService(Context.KEYGUARD_MANAGER).isKeyguardLocked()
This what gives a true if de device is "locked" in any way, secure or insecure. For clarification, if lockscreen is None it will be ever false! But if Swipe, Pattern, PIN or Password and device is locked it will return true.
This was the searched fact in my case. Hope the next one can stop here after reading.
Upvotes: 3