EmbeddedBiometricPrompt
public
final
class
EmbeddedBiometricPrompt
extends Object
| java.lang.Object | |
| ↳ | android.hardware.biometrics.EmbeddedBiometricPrompt |
The embedded version of BiometricPrompt that allows client apps to pass in content to
display above the biometric prompt as a connected sheet.
Summary
Nested classes | |
|---|---|
class |
EmbeddedBiometricPrompt.AuthenticationCallback
Callback structure provided to |
class |
EmbeddedBiometricPrompt.Builder
A builder for the embedded version of BiometricPrompt that collects arguments to be shown on the system-provided biometric dialog. |
interface |
EmbeddedBiometricPrompt.EmbeddedContentFactory
A factory that produces the custom embedded content view for the biometric prompt. |
Constants | |
|---|---|
int |
START_MODE_DEFERRED
The prompt should be collapsed and display in the deferred/paused state. |
int |
START_MODE_IMMEDIATE
Start authentication immediately with the full prompt displayed. |
int |
START_MODE_IMMEDIATE_UNLESS_OCCLUDED
Start authentication immediately unless the embedded content height exceeds the maximum allowed dimensions. |
Public methods | |
|---|---|
int
|
getAllowedAuthenticators()
Gets the type(s) of authenticators that may be invoked by the prompt. |
EmbeddedBiometricPrompt.AuthenticationCallback
|
getAuthenticationCallback()
Gets the authentication callback used for the prompt. |
Executor
|
getAuthenticationExecutor()
Gets the executor used for the authentication callback. |
int
|
getAuthenticationPurpose()
Gets the authentication purpose for the prompt. |
PromptContentView
|
getContentView()
Gets the content view, as set by |
CharSequence
|
getDescription()
Gets the description, as set by |
EmbeddedBiometricPrompt.EmbeddedContentFactory
|
getEmbeddedContentFactory()
Gets the factory that will create the content to display above the biometric prompt as a connected sheet. |
long
|
getExistingAuthSessionId()
Returns the existing auth session id for BiometricPrompt. |
List<FallbackOption>
|
getFallbackOptions()
Gets the fallback options for the prompt. |
Bitmap
|
getLogoBitmap()
Gets the logo bitmap, as set by |
String
|
getLogoDescription()
Gets the logo description, as set by |
int
|
getLogoRes()
Gets the drawable resource of the logo, as set by |
DialogInterface.OnClickListener
|
getNegativeButton()
Gets the negative button listener, as set by
|
Executor
|
getNegativeButtonExecutor()
Gets the executor used for the negative button listener, as set by
|
CharSequence
|
getNegativeButtonText()
Gets the negative button text, as set by
|
int
|
getNextTranslationOffset()
Gets the ending target layout translation offset in pixels (px) for the disappear (exit) animation. |
int
|
getPreviousTranslationOffset()
Gets the starting layout translation offset in pixels (px) for the appear (entry) animation. |
BiometricPromptStyleSpec
|
getStyleSpec()
Returns a |
CharSequence
|
getSubtitle()
Gets the subtitle, as set by |
CharSequence
|
getTitle()
Gets the title, as set by |
boolean
|
isConfirmationRequired()
Determines if explicit user confirmation is required by the prompt. |
void
|
pauseAuthentication()
Pauses biometric authentication and collapses the biometric prompt to the delayed state, displaying a button in its place. |
void
|
resumeAuthentication()
Activates biometric authentication and starts the biometric sensor scanning if delayed authentication was configured. |
void
|
setNextTranslationOffset(int offset)
Sets the ending target layout translation offset in pixels (px) for the disappear (exit) animation. |
void
|
startAuthenticationSession(CancellationSignal cancel, int startMode, Executor executor, EmbeddedBiometricPrompt.AuthenticationCallback callback)
Starts an authentication session for embedded BiometricPrompt. |
Inherited methods | |
|---|---|
Constants
START_MODE_DEFERRED
public static final int START_MODE_DEFERRED
The prompt should be collapsed and display in the deferred/paused state. A shorter bottom
sheet with a down arrow button is shown in place of the full prompt, and biometric sensors
are not activated.
Apps can call resumeAuthentication() when ready to expand the
bottom sheet to the full prompt and activate biometric sensors to begin authenticating.
Constant Value: 2 (0x00000002)
START_MODE_IMMEDIATE
public static final int START_MODE_IMMEDIATE
Start authentication immediately with the full prompt displayed.
Constant Value: 0 (0x00000000)
START_MODE_IMMEDIATE_UNLESS_OCCLUDED
public static final int START_MODE_IMMEDIATE_UNLESS_OCCLUDED
Start authentication immediately unless the embedded content height exceeds the maximum
allowed dimensions. If authentication is started and the provided embedded content exceeds
the maximum available space, the prompt displays in the deferred/paused state, where it shows
a shorter bottom sheet with a down arrow button in place of the full prompt, and biometric
sensors are not activated.
Apps can listen for AuthenticationCallback.onAuthenticationPaused in this case,
and respond by calling resumeAuthentication() when ready to expand the
bottom sheet to the full prompt and activate biometric sensors to begin authenticating.
Constant Value: 1 (0x00000001)
Public methods
getAllowedAuthenticators
public int getAllowedAuthenticators ()
Gets the type(s) of authenticators that may be invoked by the prompt.
| Returns | |
|---|---|
int |
A bit field representing the type(s) of authenticators that may be invoked by the prompt. |
getAuthenticationCallback
public EmbeddedBiometricPrompt.AuthenticationCallback getAuthenticationCallback ()
Gets the authentication callback used for the prompt.
| Returns | |
|---|---|
EmbeddedBiometricPrompt.AuthenticationCallback |
The authentication callback used for the prompt, or null if not set. |
getAuthenticationExecutor
public Executor getAuthenticationExecutor ()
Gets the executor used for the authentication callback.
| Returns | |
|---|---|
Executor |
The executor used for the authentication callback, or null if not set. |
getAuthenticationPurpose
public int getAuthenticationPurpose ()
Gets the authentication purpose for the prompt.
| Returns | |
|---|---|
int |
The authentication purpose.
Value is one of the following: |
getContentView
public PromptContentView getContentView ()
Gets the content view, as set by Builder.setContentView(PromptContentView).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
| Returns | |
|---|---|
PromptContentView |
The content view for the prompt, or null if the prompt has no content view. |
getDescription
public CharSequence getDescription ()
Gets the description, as set by Builder.setDescription(CharSequence).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
| Returns | |
|---|---|
CharSequence |
The description for the prompt, or null if the prompt has no description. |
getEmbeddedContentFactory
public EmbeddedBiometricPrompt.EmbeddedContentFactory getEmbeddedContentFactory ()
Gets the factory that will create the content to display above the biometric prompt as a connected sheet.
| Returns | |
|---|---|
EmbeddedBiometricPrompt.EmbeddedContentFactory |
The factory used to create the content view.
This value cannot be null. |
getExistingAuthSessionId
public long getExistingAuthSessionId ()
Returns the existing auth session id for BiometricPrompt.
| Returns | |
|---|---|
long |
The existing auth session id, or
ERROR(BiometricConstants.BIOMETRIC_REQUEST_ID_UNSET/android.hardware.biometrics.BiometricConstants#BIOMETRIC_REQUEST_ID_UNSET BiometricConstants.BIOMETRIC_REQUEST_ID_UNSET) if none has been set. |
getFallbackOptions
public List<FallbackOption> getFallbackOptions ()
Gets the fallback options for the prompt.
| Returns | |
|---|---|
List<FallbackOption> |
The fallback options for the prompt.
This value cannot be null. |
getLogoBitmap
public Bitmap getLogoBitmap ()
Gets the logo bitmap, as set by Builder.setLogoBitmap(Bitmap).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
Requires Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED
| Returns | |
|---|---|
Bitmap |
The logo bitmap of the prompt, or null if the prompt has no logo bitmap set. |
getLogoDescription
public String getLogoDescription ()
Gets the logo description, as set by Builder.setLogoDescription(String).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
Requires Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED
| Returns | |
|---|---|
String |
The logo description of the prompt, or null if the prompt has no logo description set. |
getLogoRes
public int getLogoRes ()
Gets the drawable resource of the logo, as set by Builder.setLogoRes(int).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
Requires Manifest.permission.SET_BIOMETRIC_DIALOG_ADVANCED
| Returns | |
|---|---|
int |
The drawable resource of the logo, or 0 if the prompt has no logo resource set. |
getNegativeButton
public DialogInterface.OnClickListener getNegativeButton ()
Gets the negative button listener, as set by
Builder.setNegativeButton(CharSequence,Executor,DialogInterface.OnClickListener).
| Returns | |
|---|---|
DialogInterface.OnClickListener |
The negative button listener, or null if not set. |
getNegativeButtonExecutor
public Executor getNegativeButtonExecutor ()
Gets the executor used for the negative button listener, as set by
Builder.setNegativeButton(CharSequence,Executor,DialogInterface.OnClickListener).
| Returns | |
|---|---|
Executor |
The executor used for the negative button listener, or null if not set. |
getNegativeButtonText
public CharSequence getNegativeButtonText ()
Gets the negative button text, as set by
Builder.setNegativeButton(CharSequence,Executor,DialogInterface.OnClickListener).
| Returns | |
|---|---|
CharSequence |
The negative button text, or null if not set. |
getNextTranslationOffset
public int getNextTranslationOffset ()
Gets the ending target layout translation offset in pixels (px) for the disappear (exit) animation.
In portrait mode, this target offset is applied vertically along the Y-axis.
In landscape mode, this target offset is applied horizontally along the X-axis.
| Returns | |
|---|---|
int |
The ending target translation offset in pixels (px). |
getPreviousTranslationOffset
public int getPreviousTranslationOffset ()
Gets the starting layout translation offset in pixels (px) for the appear (entry) animation.
In portrait mode, this offset is applied vertically along the Y-axis.
| Returns | |
|---|---|
int |
The starting translation offset in pixels (px), or -1 if the system default is used. |
getStyleSpec
public BiometricPromptStyleSpec getStyleSpec ()
Returns a BiometricPromptStyleSpec containing the style specifications of
BiometricPrompt
| Returns | |
|---|---|
BiometricPromptStyleSpec |
the style specifications of BiometricPrompt.
This value may be null. |
getSubtitle
public CharSequence getSubtitle ()
Gets the subtitle, as set by Builder.setSubtitle(CharSequence).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
| Returns | |
|---|---|
CharSequence |
The subtitle for the prompt, or null if the prompt has no subtitle. |
getTitle
public CharSequence getTitle ()
Gets the title, as set by Builder.setTitle(CharSequence).
This is only applicable to the device credential fallback page (when the user is
authenticating with PIN/pattern/password).
| Returns | |
|---|---|
CharSequence |
The title of the prompt, or null if not set. |
isConfirmationRequired
public boolean isConfirmationRequired ()
Determines if explicit user confirmation is required by the prompt.
| Returns | |
|---|---|
boolean |
true if explicit user confirmation is required, or false otherwise. |
pauseAuthentication
public void pauseAuthentication ()
Pauses biometric authentication and collapses the biometric prompt to the delayed state, displaying a button in its place.
resumeAuthentication
public void resumeAuthentication ()
Activates biometric authentication and starts the biometric sensor scanning if delayed
authentication was configured.
If authentication was started with START_MODE_IMMEDIATE_UNLESS_OCCLUDED and the
embedded content exceeds the allowed dimensions, or authentication was started with
START_MODE_DEFERRED, the prompt is initially hidden and in a paused state, instead
displaying a downward arrow button. Calling this method transitions the layout to show the
sensor and biometric prompt content, and activates the biometric sensor to actively start
authenticating.
setNextTranslationOffset
public void setNextTranslationOffset (int offset)
Sets the ending target layout translation offset in pixels (px) for the disappear (exit) animation.
When the prompt is dismissed, it animates from its resting position to this target layout offset.
In portrait mode, the target offset is applied vertically along the Y-axis.
In landscape mode, the target offset is applied horizontally along the X-axis.
| Parameters | |
|---|---|
offset |
int: The target translation offset in pixels (px). |
startAuthenticationSession
public void startAuthenticationSession (CancellationSignal cancel, int startMode, Executor executor, EmbeddedBiometricPrompt.AuthenticationCallback callback)
Starts an authentication session for embedded BiometricPrompt.
This call warms up the biometric hardware, displays a system-provided dialog, and starts
scanning for a biometric. Authentication starts when
AuthenticationCallback.onSessionStarted(long) is called, terminates when AuthenticationCallback.onAuthenticationError(int,CharSequence) is called,
when AuthenticationCallback.onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult) is called, or when the user dismisses the
system-provided dialog. This operation can be canceled by using the provided cancel object.
The application will receive authentication errors through AuthenticationCallback, and button events through the corresponding
callback set in Builder.addFallbackOption(CharSequence,int,Executor,DialogInterface.OnClickListener).
| Parameters | |
|---|---|
cancel |
CancellationSignal: An object that can be used to cancel authentication.
This value cannot be null. |
startMode |
int: The mode determining when authentication starts (e.g. START_MODE_IMMEDIATE, START_MODE_IMMEDIATE_UNLESS_OCCLUDED, or START_MODE_DEFERRED).
Value is one of the following: |
executor |
Executor: An executor to handle callback events.
This value cannot be null.
Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is
used. To dispatch events through the main thread of your
application, you can use
Context.getMainExecutor().
Otherwise, provide an Executor that dispatches to an appropriate thread. |
callback |
EmbeddedBiometricPrompt.AuthenticationCallback: An object to receive authentication events.
This value cannot be null. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-08-28 UTC.