Lock the screen programmatically on Android
<p>I have to lock the screen programatically from my application.</p>

<p>I have used the following code:</p>

<pre class="lang-java prettyprint-override"><code>String service = Activity.KEYGUARD_SERVICE;
KeyguardManager mgr = (KeyguardManager)getSystemService(service);
KeyguardLock lock = mgr.newKeyguardLock(KEYGUARD_SERVICE);
lock.reenableKeyguard();
</code></pre>

<p>I set following permission in the AndroidManifest.</p>

<pre><code> &lt;uses-permission android:name="android.permission.DISABLE_KEYGUARD" /&gt;
</code></pre>

<p>However, it is not giving me any result and not even giving me any error or exception.</p>

<p>What am I missing?</p>
