Credential
There are cases where the app need to authenticate user using credential or biometric embedded on the device for example to validate a transaction before purchase. This module bring biometricHandler
to simplify that task.
Start by initializing it:
val biometric = Biometric(activity)
Check Biometric¶
To check does user's device embedded with biometric (fingerprint or face detection). Call this method:
biometric.checkBiometricAvailable { enabled ->
if (enabled) {
// Action when biometric is available
} else {
// Action when biometric is not available
}
}
Prompt biometric¶
To prompt user with biometric authentication, call this method:
biometric.promptBiometric { success, message ->
if (success) {
// Action when the authentication success
} else {
// Action when the authentication failed,
// message variable contain error message
}
}