以编程方式锁定 Android 设备
我一直试图通过程序锁定设备。但我仍然找不到解决方案。 我想通过程序锁定Android froyo2.2。我尝试过 keyguardmanager 和 DeviceAdminManager。
我的应用程序是远程锁定设备。当收到带有一些要锁定的代码字的消息时,它就会锁定手机。我找到了许多 Api_demo 程序作为解决方案,但我无法从中单独提取锁定代码并找到解决方案。
I have been trying to lock the device through program. But I can't find the solution still.
I want to lock Android froyo2.2 through program. I have tried keyguardmanager and DeviceAdminManager.
My app is to remote lock the device. When message is received with some code words to lock then it locks the phone. I have found many Api_demo program as solution but I can't extract lock code alone from that and find solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Activity 类应该是内部类,外部类应该扩展 DeviceAdminReceiver
要锁定设备,请在用于锁定的事件中编写代码。
如果启用了 DeviceAdmin,则手机将被锁定。
要启用设备管理,将调用 DevicePolicyManager 意图,并且应由用户启用它。
The activity class should be inner class and the outter class should extend DeviceAdminReceiver
To lock the device write the code in the event where you use to lock
If DeviceAdmin is enabled then the phone will be locked.
To enable the device admin, the DevicePolicyManager intent is called and it should be enabled by the user.
为了解决此任务,您可以查看 NoKeyGuard 源代码更准确地说,是 NoKeyGuard Service 类和 KeyguardLockWrapper 类。
要解锁设备,请在使用解锁的情况下写入代码:
In order to solve this task you can take a look to NoKeyGuard source code and more precisely to a NoKeyGuard Service class and KeyguardLockWrapper class.
To unlock the device write the code in the event where you use to unlock:
Activity 类应该是内部类,外部类应该扩展
DeviceAdminReceiver
The activity class should be the inner class and the outer class should extend
DeviceAdminReceiver