I have a problem about making lockscreen.
The developer site recommends to use one of this methods
Method:
private void setFlag(){ getWindow().addFlags( WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); }
Method (it is deprecated)
private void disableLock() { private KeyguardManager km = null; private KeyguardManager.KeyguardLock keyLock = null; if (km == null) km = ((KeyguardManager) getSystemService("keyguard")); if (keyLock == null) keyLock = km.newKeyguardLock("keyguard"); keyLock.disableKeyguard(); }
When I used 1. method, when screen turn on by power button it goes off again immediately (Editor: Tried my best to understand it, not sure I got it right).
When I used 1. and 2. method there is no problem!
I want to replace this method
keyLock = km.newKeyguardLock("keyguard");
is there any way to replace this method?
Thank you so much for you to read the post :)