Android : Difference between DeviceLock and screen off

on Wednesday, August 13, 2014


What is the difference between device lock (using power button) and screen off (setting/display/Screen timeout) ?


The Intent.ACTION_SCREEN_ON or Intent.ACTION_SCREEN_OFF is invoked on both device lock and screen off actions. Is there is any event available that only triggered on the device lock (using power button) and not for the screen off.



KeyguardManager kgMgr = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
boolean hasDeviceLocked = kgMgr.inKeyguardRestrictedInputMode();


hasDeviceLocked has always return true for both the device lock and the screen off.


Any other solution for this?


Thanks Mindus


0 comments:

Post a Comment