禁用锁定屏幕屏幕

2023-09-12 04:10:24 作者:飘神

我要寻找一种方式来取代股票锁屏(带有一个应用程序,而不是ROM)。 什么是做到这一点,一开始取消对尽可能多的设备尽可能的锁屏的最佳方法是什么? 谢谢!

解决方案

  KeyguardManager keyguardManager =(KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock锁= keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
 

在androidmanifest:

 <使用-权限的Andr​​oid:名称=android.permission.DISABLE_KEYGUARD/>
 

如何在 Windows 11 上自定义锁定屏幕

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