0

Possible Duplicate:
how to programmaticaly lock screen android

Hie team gud eve, I have tried using keygaurdmanager its executing, but what i need is when i click on the application the screen should be locked immediately. can any one suggest me how its possible..

Like: Lock app in android market

Thanks in Advance

Community
  • 1
  • 1
sukesh
  • 3
  • 1
  • 4

1 Answers1

0

This will help you ::

KeyguardManager mgr = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE); 
KeyguardLock lock = mgr.newKeyguardLock(KEYGUARD_SERVICE); 
lock.reenableKeyguard();

For more description

Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
  • Thanks for the reply, it is executing But i need to lock the whole device Like https://market.android.com/details?id=com.droidmania.lockscreenwidget&feature=search_result – sukesh Sep 06 '11 at 10:02
  • 1
    put this code in service and make it booting time so when you start your phone execute this portion and locking shown initially – Nikunj Patel Sep 06 '11 at 10:04