Disable (initial) screen lock

7 votes · 2 comments

As I mentioned before we are currently developing an application which runs on a dedicated android-device. When implementing the auto-start function I noticed that android enters a screen-locked state after booting. This snippet disables the lock.

raw ·
copy
· download
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE); KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); lock.disableKeyguard(); in androidmanifest: <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
Add a comment

2 Comments

Marcus,

in which file, do i need to modify. can i get the full source code. i am having android on our custom board. i need to disable keylock during booting-up.

Thanks and Regards, HarishKumar.V

Reply · Aug. 4, 2009, 11:53 p.m.

should i call it from every activity? or once on application running? and when the KeyguardLock released and opened?

Reply · Sept. 7, 2011, 8:20 a.m.