Android biometric library inspired from androidx.biometric for non androidx apps.
Get to your project:
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.exxbrain:android-biometric:{Version}'
//...
}
int error = BiometricManager.from(MainActivity.this).canAuthenticate();
if (error != BiometricManager.BIOMETRIC_SUCCESS) {
/// Can't authenticate at all
}
BiometricPrompt.AuthenticationCallback authenticationCallback =
new BiometricPrompt.AuthenticationCallback() {
//...
};
BiometricPrompt biometricPrompt =
new BiometricPrompt(MainActivity.this, executor, authenticationCallback);
BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setTitle("Set the title to display.")
.setSubtitle("Set the subtitle to display.")
.setDescription("Set the description to display")
.setNegativeButtonText("Negative Button")
.build();
mBiometricPrompt.authenticate(promptInfo);
Checkout and look at example app