Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

handstandsam/biometricks

Repository files navigation

PROJECT IS ARCHIVED as there is no reliable way to do this. Check related issue on the Google Issue Tracker https://issuetracker.google.com/issues/111315641

Biometricks - Tricks for Android Biometrics

Provides various hacks/tricks to help work with the AndroidX Biometric APIs.

Features:

  • The ability to detect the type of Biometric the device supports for better user messaging.
  • Ability to detect the need to show a loading dialog for API 28.
  • 100% Kotlin API, no Java support is planned.
Fingerprint Face

Why?

The AndroidX Biometric Library doesn't tell you what type of Biometric feature the device has and will be used. This library figures that out for you so you can create better user messaging than just "Biometric" in most cases.

Usage

val biometricks = Biometricks.from(applicationContext)

val biometricName = when (biometricks) {
    Face -> "Face"
    Fingerprint -> "Fingerprint"
    Iris -> "Iris"
    Unknown,
    Multiple -> "Biometric"
}

CryptoObject Required

In order to correctly have the UI show the detected biometric type, we encourage you to use our helper functions. It will require you to pass a BiometricPrompt.CryptoObject.

Biometricks.showPrompt(
    activity,
    BiometricPromptInfo(
        title = "Authenticate with $biometricName",
        negativeButtonText = "Cancel",
        cryptoObject = cryptoObject
    )
) { showLoading ->
    // Show a loading view for API 28 issues if you want
}

NOTE: This type is only valid when you show a BiometricPrompt and send in a CryptoObject.

The Types of Biometricks (Source)

sealed class Biometricks {

    /** The device has no support for Biometric Authentication */
    object None : Biometricks()

    /** The device has support for Biometric Authentication */
    sealed class Available : Biometricks() {
        object Face : Available()
        object Fingerprint : Available()
        object Iris : Available()
        object Multiple : Available()
        object Unknown : Available()
    }
}

Related Content

Contributors

About

Biometricks - Tricks for Android Biometrics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages