Detect Lock Screen Incorrect Password by user in Android

后端 未结 3 1354
情话喂你
情话喂你 2020-12-08 09:02

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 f

3条回答
  •  眼角桃花
    2020-12-08 09:43

    1. First step is to get your app the DEVICE_ADMIN privilege by the user.

    2. Write your own class which extends DeviceAdminReceiver. For this you need to import import android.app.admin.DeviceAdminReceiver;

    3. Override the methods in your case something like:

      @Override
      public void onPasswordFailed(Context context, Intent intent) {
          Log.d("Hello", "onPasswordFailed");
      }
      @Override
      public void onPasswordSucceeded(Context context, Intent intent) {
          Log.d("Hello", "onPasswordSucceeded");
      }
      

提交回复
热议问题