Locking the Android and disabling fingerprint

415 Views Asked by At

On some events, I'd like to lock the phone screen and require password (not fingerprint). That is, the fingerprint would be disabled just temporarily for one unlock. After the unlock, the user would be able to use fingerprint again. This is similar to the lockdown mode.

I have looked for a suitable API for that and I have found just two things:

a. Device administrator API. It seems to be the way to go, except that it is deprecated. b. GLOBAL_ACTION_LOCK_SCREEN – not deprecated, but it does not disable the fingerprint.

1

There are 1 best solutions below

4
On

Please try this

KeyguradManager mgr = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
Intent i = mgr.createConfirmDeviceCredentialIntent("title", "description");
startActivityForResult(i, REQUEST_CODE);

you can handle the result in onActivityResult()

  protected void onActivityResult(int requestCode, int resultCode,
      Intent data) {
        if (requestCode==REQUEST_CODE) {
             if (resultCode==RESULT_OK) {
                //authenticated
                  }
                  else {
               // not authenticated
             }
          }
       }