I was recently trying to request user to dismiss key-guard manually from my app. My app invokes a activity screen when device is locked and the screen has the flags
FLAG_SHOW_WHEN_LOCKED
FLAG_TURN_SCREEN_ON
When I have to invoke another screen which does not have these flags I want to request the user to unlock the key-guard, this behaviour can be seen in the the camera app - when we want to share a photo taken while phone is locked it will request us to unlock the device.
requestDismissKeyguard() method works only for api26 and above any alternatives for the lower apis ??
you can use flags for lower versions
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With