I have an issue where Keyguard Screen is coming infront of incall screen.Need a way dismiss the Keyguard Screen.This is on 4.1 android version.I tried all the flags of windowmanager.layoutparams but did not succeed in dismissing the keyguard screen.
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
keyguard = km.newKeyguardLock("MyApp");
to disable keygurd
public void unlockPhone() {
keyguard.disableKeyguard();
}
and dont forget to re enable it
public void lockPhone() {
keyguard.reenableKeyguard();
}
dont forget to use DISABLE_KEYGUARD permissionin.
This works for me on KitKat
In onCreate before setContentView and after super
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
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