Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 2.77 KB

README.md

File metadata and controls

51 lines (38 loc) · 2.77 KB

BiometricsAuthentication

Kotlin Android Gradle

Basic android example where you can find how to implement Biometrics Prompt

Requirements

  • Android API 21 - 31
  • Gradle 7.2
  • Kotlin 1.6.10

Functionalities

There are multiple options to display biometrics prompt. In this example there are 4 options:

  • Unlock with Biometric String: Fingerprint authentication prompt will appear

image

  • Unlock with Biometric Weak: Fingerprint and Face authentication prompt will appear
image image
- `Unlock with Device Credential`: Device credential authentication prompt will appear (pattern or pin code authentication)

image

  • Unlock with Biometric Weak and Device Credential: Fingerprint, Face and Device credential authentication prompt will appear

image

Notes

  • Prompt's description can be modified setDescription("New Description")
    • In this case it has not been modified, so in the screenshots you can see that the description is in another language. The description is set to the default value and is set to the language of the device.
BiometricPrompt.PromptInfo.Builder().apply {
            setTitle(activity.getString(R.string.prompt_info_title))
            setDescription("New Description")
            setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_WEAK or BiometricManager.Authenticators.DEVICE_CREDENTIAL)
            setConfirmationRequired(false)
        }.build()
  • Same in option Unlock with Biometric Weak and Device Credential, the device credential authentication button is set based on the device settings (pattern or PIN code) and also set based on the device language.

  • This example has been done with Biometric Library 'androidx.biometric:biometric-ktx:1.2.0-alpha04'

  • To know more about biometrics check this link