Biometric
Biometric gives you access to 5 events and 2 procedures. With Biometric, you can have the user authenticate using biometrics such as face unlock, fingerprint, password, pattern, or pin! You can’t directly specify which one(s) the system will prompt the user to authenticate with, but you can give a hint of which types to provide.
This is excluded from my open-source policy. Minimum version required is Android Lollipop 5.0 or API 21.
Permissions
USE_BIOMETRIC and USE_FINGERPRINT. These are automatically granted by the system.
AuthenticationError
Called when an unrecoverable error has been encountered and the operation is complete.
Parameter | Type |
---|---|
code | int |
error | string |
AuthenticationFailed
Called when a biometric is valid but not recognized.
AuthenticationHelp
Called when a recoverable error has been encountered during authentication.
Description | Parameter | Type |
---|---|---|
code | int | |
Outputs a human readable string. | string | string |
AuthenticationSucceeded
Called when a biometric is recognized.
NegativeActionClicked
Called when a recoverable error has been encountered during authentication.
Parameter | Type |
---|---|
action | string |
Authenticate
Warms up the biometric hardware, displays a system-provided dialog, and starts scanning for a biometric. This procedure has support for Android back to Lollipop (API 21).
Be aware that this was tested using Android 11 or API 30. If there are any issues with lower APIs, please report them.
API(s) | Behavior | Fallback | Tested |
---|---|---|---|
28+ | Will not ignore the parameters given | System determines | true |
23...27 | Will ignore the parameters given | Fingerprint; Password, Pattern, or Pin if non enrolled | false |
21...22 | Will ignore the parameters given | Password, Pattern, or Pin | false |
Parameter | Required | Type |
---|---|---|
description | false | string |
negativeActionText | false, only if security strength is not Auto | string |
requireConfirmation | can be false | boolean |
strength | true | int (Auto [n != 1 && n != 2], Strong [1], Weak [2]) |
subtitle | false | string |
title | true | string |
Description | Strength |
---|---|
Will use device credentials such as Password, Pattern, or Pin. If the device supports fingerprint scanning, then it will use that. | Auto |
Will use face, fingerprint scanning, or iris scanning. Limited by hardware and relies on the system determination. | Strong |
Will use Password, Pattern, or Pin. | Weak |
CanAuthenticate
Determine if biometrics can be used.
Parameter | Type |
---|---|
strength | int (Auto [n != 1 && n != 2], Strong [1], Weak [2]) |
io.gitlab.stormifire.biometric.aix (11.0 KB)