https://github.com/lopspower/biometric
The easiest way is to use the new version of Biometric under AndroidX 🔒
https://github.com/lopspower/biometric
android androidx biometric
Last synced: 3 months ago
JSON representation
The easiest way is to use the new version of Biometric under AndroidX 🔒
- Host: GitHub
- URL: https://github.com/lopspower/biometric
- Owner: lopspower
- License: apache-2.0
- Created: 2020-01-06T09:55:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-21T07:34:55.000Z (almost 5 years ago)
- Last Synced: 2024-05-01T21:18:47.575Z (about 2 years ago)
- Topics: android, androidx, biometric
- Language: Kotlin
- Homepage:
- Size: 2.85 MB
- Stars: 140
- Watchers: 6
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

Biometric
=================

[](http://developer.android.com/index.html)
[](https://android-arsenal.com/api?level=16)
[](https://search.maven.org/artifact/com.mikhaellopez/biometric)
[](http://twitter.com/lopezmikhael)
The easiest way is to use the new version of [Biometric](https://developer.android.com/jetpack/androidx/releases/biometric) under [AndroidX](https://developer.android.com/jetpack/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](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.CryptoObject) implementation if you want to implement it on your side on [CryptoHelper](/biometric/src/main/java/com.mikhaellopez.biometric/CryptoHelper.kt).
USAGE
-----
To used this usefull library you can grab it via Gradle:
```groovy
implementation 'com.mikhaellopez:biometric:1.1.0'
```
KOTLIN
-----
```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:
```kotlin
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 |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
|
|
SUPPORT ❤️
-----
Find this library useful? Support it by joining [**stargazers**](https://github.com/lopspower/Biometric/stargazers) for this repository ⭐️
And [**follow me**](https://github.com/lopspower?tab=followers) for my next creations 👍
LICENCE
-----
Biometric by [Lopez Mikhael](http://mikhaellopez.com/) is licensed under a [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).