FLAG_DISMISS_KEYGUARD to unlock a screen
<p>I am using <code>FLAG_DISMISS_KEYGUARD</code> to disable a keygaurd. This is working only when my app is on foreground. But android documents syas that </p>

<blockquote>
  <p>Use FLAG_DISMISS_KEYGUARD and/or FLAG_SHOW_WHEN_LOCKED instead; this
  allows you to seamlessly hide the keyguard as your application moves
  in and out of the foreground and does not require that any special
  permissions be requested</p>
</blockquote>

<p>this is not happening in my application. Then how to use the above flag so that my application should lock the screen when my app moves in and out of the foreground?</p>

<p>Any one have idea?</p>
