2010年10月6日 星期三

Disable locker of android

Use keyguardManager, and put right permission in AndroidManifest

Initialize

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
final KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
To invoke the function

lock.disableKeyguard();
or
lock.reenableKeyguard();

in AndroidManifest

<uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>

沒有留言: