Skip to content

Biometric Prompt

Non-Visible component
Category Requires Version
Sensors API 21, Android 5.0 Lollipop 1

Overview

A component that provides biometric authentication (fingerprint, face, iris) and device credential authentication (PIN, pattern, password). Requires Android 6 (API 23) or higher for device credentials and Android 9 (API 28) or higher for the unified biometric prompt UI.

Permissions

Events

On Authentication Error

Triggered on a non-recoverable authentication error. The prompt is dismissed. Common error codes: 7 = too many attempts (temporary lockout), 9 = permanent lockout, 10 = user canceled, 11 = no biometrics enrolled, 12 = no biometric hardware.

Params
error Code Number
error Message Text

On Authentication Failed

Triggered when a biometric is recognized but does not match (e.g., wrong finger). The prompt stays open for retry. May fire multiple times.

On Authentication Succeeded

Triggered when biometric or device credential authentication succeeds.

On Negative Button Clicked

Triggered when the user taps the negative/cancel button (only in BiometricOnly mode). Use this to handle user-initiated cancellation.

Methods

Authenticate

Starts authentication. Fires OnAuthenticationSucceeded, OnAuthenticationFailed, OnAuthenticationError, or OnNegativeButtonClicked based on the result.

Cancel Authentication

Cancels the current biometric authentication. Safe to call even if no authentication is in progress.

Has Biometric Hardware

Returns: Boolean

Returns true if the device has biometric hardware (fingerprint sensor, face sensor, etc.).

Has Enrolled Biometrics

Returns: Boolean

Returns true if at least one biometric (fingerprint, face, etc.) is enrolled on the device.

Is Available

Returns: Boolean

Returns true if authentication is available right now with the current AuthenticatorType setting. This is the recommended check before calling Authenticate.

Properties

Authenticator Type

Com.google.appinventor.components.common.authenticatortypeenum Default: BiometricOrDeviceCredential ➖ Read Write - Designer Blocks

Sets the type of authentication allowed. BiometricOnly = biometrics only, DeviceCredentialOnly = PIN/pattern/password, BiometricOrDeviceCredential = biometrics with PIN fallback.

Description

Text ➖ Read Write - Designer Blocks

Sets the optional description displayed on the biometric prompt.

Negative Button Text

Text Default: Cancel ➖ Read Write - Designer Blocks

Sets the text for the negative button on the biometric prompt. Only shown when AuthenticatorType is BiometricOnly. Ignored when device credentials are allowed.

Subtitle

Text ➖ Read Write - Designer Blocks

Sets the optional subtitle displayed on the biometric prompt.

Title

Text Default: Verify your identity ➖ Read Write - Designer Blocks

Sets the title displayed on the biometric prompt.