Show authentication prompt with only device credential option on Android 10 and lower

862 views Asked by At

I can display biometric prompt with device credentials using 'androidx.biometric:biometric:1.2.0-alpha03' as,

val promptInfo = BiometricPrompt.PromptInfo.Builder()
            .setTitle("Login to My App")
            .setSubtitle("Log in using your biometric credential")
            .setConfirmationRequired(false)
            .setAllowedAuthenticators(BIOMETRIC_WEAK or DEVICE_CREDENTIAL)
            .build()

Now I want this prompt to show only device credential option(pin/pattern) without biometrics on Android 10 and before, even if its being enrolled in device security.

As per doc, BiometricPrompt.setAllowedAuthenticators(DEVICE_CREDENTIALS), this isn't supported on Android 10 (API level 29) and lower.

And KeyguardManager.createConfirmDeviceCredentialIntent(..) this by default includes both biometric and device credentials. I couldn't find any customization for KeyguardManager.

Is there any other way to display only device credential option without biometrics?

0

There are 0 answers