I need to lock the screen programmatically from my application.
I used the following code:
String service = Activity.KEYGUARD_SERVICE; KeyguardManager mgr = (KeyguardManager)getSystemService(service); KeyguardLock lock = mgr.newKeyguardLock(KEYGUARD_SERVICE); lock.reenableKeyguard();
I set the following permission in AndroidManifest.
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
However, this does not give me any result and does not even give me any errors or exceptions.
What am I missing?
source share