Skip to content

The easiest way is to use the new version of Biometric under AndroidX 🔒

License

Notifications You must be signed in to change notification settings

lopspower/Biometric

Repository files navigation

Biometric

sample

Platform API Maven Central Twitter

The easiest way is to use the new version of Biometric under AndroidX.

You can easily know if the device allows you to use Biometric and under what type (FACE, FINGERPRINT, IRIS, MULTIPLE...). The library also provides a CryptoObject implementation if you want to implement it on your side on CryptoHelper.

Android app on Google Play

USAGE

To used this usefull library you can grab it via Gradle:

implementation 'com.mikhaellopez:biometric:1.1.0'

KOTLIN

val biometricHelper = BiometricHelper(fragment)

// BiometricType = FACE, FINGERPRINT, IRIS, MULTIPLE or NONE
val biometricType: BiometricType = biometricHelper.getBiometricType()

// Check if biometric is available on the device
btnStart.visibility = if (biometricHelper.biometricEnable()) View.VISIBLE else View.GONE

btnStart.setOnClickListener {
    biometricHelper.showBiometricPrompt(
        BiometricPromptInfo(
            title = "Title", // Mandatory
            negativeButtonText = "Cancel", // Mandatory
            subtitle = "Subtitle",
            description = "Description",
            confirmationRequired = true
        )
    ) {
        // Do something when success

    }
}

You can also handle error and failed like this:

biometricHelper.showBiometricPrompt(promptInfo,
    onError = { errorCode: Int, errString: CharSequence ->
        // Do something when error
                    
    }, onFailed = {
        // Do something when failed
                    
    }, onSuccess = { result: BiometricPrompt.AuthenticationResult ->
        // Do something when success
                    
    })

DEMO

Dark Mode Biometric Fingerprint Old Fingerprint
sample sample sample

SUPPORT ❤️

Find this library useful? Support it by joining stargazers for this repository ⭐️
And follow me for my next creations 👍

LICENCE

Biometric by Lopez Mikhael is licensed under a Apache License 2.0.

About

The easiest way is to use the new version of Biometric under AndroidX 🔒

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published