检测锁屏密码不正确用户在Android中不正确、密码、用户、Android

2023-09-12 22:54:03 作者:给别人的幸福让道i

我建立一个安全的应用程序,我需要知道,如果用户正在给密码不正确。假设用户手机由图案锁系统锁定,不幸的是用户忘记了图案password.When用户给出错误的模式5的时候,会有一个点球,持续30秒。 我需要赶上处罚事件。 在我的应用程序,我不得不做一些任务(用户安全)时,这甚至来了。 请帮帮我,

I am building a security app and I need to know if the user is giving incorrect password . Suppose user phone is locked by pattern lock system , and unfortunately user has forgotten the pattern password.When user give wrong pattern 5 time, there will be a penalty for 30 sec . I need to catch that penalty event . In my app, i have to do some task (for the safety of user) when this even come . Please help me,

推荐答案

您可以设置 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:

the DeviceAdminReceiver 实施 the设备管理元数据,说明什么是管理能力,你的应用程序要 接收器在the清单 code在the活动来检测,如果你的应用程序被批准作为设备管理员,如果没有,导致用户在设置现场进行改变 the DeviceAdminReceiver implementation the device admin metadata, stating what administrative capabilities your app wants the receiver's entry in the manifest code in the activity to detect if your app is approved to serve as a device administrator and, if not, lead the user to the spot in Settings to make that change