开发者

Disable Lock Screen

开发者 https://www.devze.com 2023-02-04 05:07 出处:网络
I am looking for a way to replace the stock lock screen (with an app, not a rom). What is the best way to do it, for a start to disable the lock screen on a开发者_如何转开发s much devices as possible?

I am looking for a way to replace the stock lock screen (with an app, not a rom). What is the best way to do it, for a start to disable the lock screen on a开发者_如何转开发s much devices as possible? Thanks!


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"/>


You can just use this line in the activity:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);


Try this, it will keep awake the screen/ display , as long as the activity is on top.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Also this does not require any permission in manifest.


Check out this link http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

listen to the screen on intent and I guess just launch your lock screen.

0

精彩评论

暂无评论...
验证码 换一张
取 消