Files
AndroidJetpack/KAHelpers/biometrics
coco 723ce1af5c a
2026-07-03 15:12:48 +08:00
..
a
2026-07-03 15:12:48 +08:00
a
2026-07-03 15:12:48 +08:00
a
2026-07-03 15:12:48 +08:00
a
2026-07-03 15:12:48 +08:00
a
2026-07-03 15:12:48 +08:00
a
2026-07-03 15:12:48 +08:00

Biometrics

Usage

  1. Add JitPack to your project build.gradle
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
   }
}
  1. Add the dependency in the application build.gradle
dependencies {

implementation "com.github.FunkyMuse.KAHelpers:biometrics:$utilsVersion"

}
  1. Add necessary permissions
<uses-permission android:name="android.permission.USE_BIOMETRIC" />

//if you're using the legacy FingerprintController
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
  1. Example
canAuthenticate(hardwareUnavailable = {
            //some message about hardware missing
        }, noFingerprintsEnrolled = {
            //make user action to enroll fingerprints
        }) {
            biometricAuth(promptInfoAction = {
                setTitle("Verification required")
                setSubtitle("Action paused")
                setDescription("Please verify your identity to proceed with the action")
                setDeviceCredentialAllowed(true)
                this
            }, onAuthFailed = {
                //auth failed action
            }, onAuthError = { errorCode, errorMessage ->
                //handle auth error message and codes

            }) {
                //handle successful authentication
            }
        }