如何锁定Android设备通过编程方式......有没有可能?方式、设备、Android

2023-09-04 07:15:27 作者:攻她心房,占心为王

可能重复:   锁定Android设备编程

任何一个可以帮助我如何锁定使用Java程序的设备,在这里我没有使用任何UI意味着我做的服务和用户不知道发生了什么在他的设备。 通过使用MSM通知我去锁定装置未经用户许可。 我试图KeygardManager和DeviceAdmin,但他们给安全例外。

Can any one help me how to lock a device using java Program, and here i am not using any UI means i am doing on the Service and user can not know what happening in his device. by using msm Notification i am going to locking the device without user permission. I Tried KeygardManager and DeviceAdmin but they are giving Security exceptions.

有没有人来帮助。 先谢谢了。

Is there any one to help. Thanks in advance.

推荐答案

是的,这是可能的,试试这个code,

yes, It is possible, try this code,

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

有更好的理解,请访问该link.

for better understand , please visit this link.

 
精彩推荐