androidandroid-studioandroid-securitykeyguarddevice-policy-manager

How to remove fingerprint authentication from Android KeyGaurd manager?


I've used keyguard manager inside my app to perform some action if and only if the user authenticates using his default device lock credentials, now what is happening is that my device has both fingerprint and pattern/pin lock enabled and when the keyguard manager checks the authentication using isKeyguardSecure method, it starts an activity for result and opens the intent using .createConfirmDeviceCredentialIntent...Now in this intent it asks for the fingerprint by default and gives an option for pin/pattern...I want to disable the fingerprint option in my app, and do not want to remove the fingerprint security from the device itself, just disable it for that particular app or intent. This is my code:

KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
Intent screenLockIntent = keyguardManager.createConfirmDeviceCredentialIntent(title, description);
startActivityForResult(screenLockIntent, LOCK_REQUEST_CODE);

Getting the result in this method

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
    if(LOCK_REQUEST_CODE == requestCode){
        if (resultCode == RESULT_OK) {
            //Authentication is successful
              My App works now
        } else {
            //Authentication failed
        }
    }
}

Screenshot showing the fingerprint authentication which I want to remove

This all is working fine, I just want to remove the fingerprint authentication for this particular app and just use the pin/password option... Thanks in advance ;-)


Solution

  • You can't do that if you are using createConfirmDeviceCredentialIntent(), as this is a system intent and you can't change it. Generally, the screen lock is manged by the OS and will support whatever has been set up (face, fingerprint, iris, PIN, etc.)

    You could implement a custom PIN only screen in your app, but that's tricky to do and generally less secure than the one provided by the OS.