更新时间:2023-11-07 23:50:40
您可以设置 DeviceAdminReceiver
将被通知失败的密码尝试,以及作为一个成功的密码尝试失败的尝试之后发生的。这会在 Android的设备管理API的文档。
You can set up a DeviceAdminReceiver
that will be notified about failed password attempts, as well as a successful password attempt that occurred after a failed attempt. This is covered in the documentation of Android's device administration APIs.
请注意,用户必须同意让您的应用程序作为一个设备管理员,通过设置应用程序之前,你会得到这些事件。
Note that the user will have to agree to allow your app to serve as a device administrator, via the Settings app, before you will get these events.
此示例项目演示监听这些事件,再加上设置了密码质量政策。关键的部分是:
This sample project demonstrates listening for those events, plus setting up a password quality policy. The key pieces are:
DeviceAdminReceiver
实施 DeviceAdminReceiver
implementation