# androidx.biometric

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult` | Types of the terminal result of the authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback` | A callback to be called when an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult` is available. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | A launcher for a previously-`https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)` to start the process of executing an authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators` | Types of authenticators, defined at a level of granularity supported by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager` and `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentItem` | An item shown on `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentView`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentView` | Contains the information of the template of content view for Biometric Prompt. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest` | Types for configuring authentication prompt with options that are commonly used together. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric` | A set of configurable options for how the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` should appear and behave with biometric authentication with fallbacks. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Builder` | Builder used to create an instance of `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Fallback` | Fallback options for the biometric authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Fallback.CustomOption` | Custom Fallback option displayed as the negative button in prompt authentication screen if it is the only option or displayed in a list in the fallback options page if there are more than one. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Strength` | Types of biometric strength for the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Strength.Class3` | Class 3 (formerly Strong). |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.BodyContent` | Types of the body content to be displayed on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.BodyContent.ContentViewWithMoreOptionsButton` | A view with "more options" button. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.BodyContent.PlainText` | Plain text description as body content. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.BodyContent.VerticalList` | A vertical list as body content. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Credential` | A set of configurable options for how the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` should appear and behave with device credential only. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Credential.Builder` | Builder used to create an instance of `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Credential`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult.CustomFallbackSelected` | The prompt was dismissed because the user clicked a custom fallback option. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult.Error` | A result when an error has been encountered and authentication has stopped. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResult.Success` | A result when the user has successfully authenticated. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager` | A class that provides system information related to biometrics (e.g. fingerprint, face, etc.). |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Strings` | Provides localized strings for an application that uses `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` to authenticate the user. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` | A class that manages a system-provided biometric prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.AuthenticationCallback` | A collection of methods that may be invoked by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` during authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.AuthenticationResult` | A container for data passed to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(androidx.biometric.BiometricPrompt.AuthenticationResult)` when the user has successfully authenticated. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.CryptoObject` | A wrapper class for the crypto objects supported by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo` | A set of configurable options for how the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` should appear and behave. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | A builder used to set individual options for the `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo` class. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentItemBulletedText` | A list item with bulleted text shown on `https://developer.android.com/reference/kotlin/androidx/biometric/PromptVerticalListContentView`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentItemPlainText` | A list item with plain text shown on `https://developer.android.com/reference/kotlin/androidx/biometric/PromptVerticalListContentView`. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentViewWithMoreOptionsButton` | Contains the information of the template of content view with a more options button for Biometric Prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentViewWithMoreOptionsButton.Builder` | A builder used to set individual options for the `https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentViewWithMoreOptionsButton` class. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptVerticalListContentView` | Contains the information of the template of vertical list content view for Biometric Prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/PromptVerticalListContentView.Builder` | A builder used to set individual options for the `https://developer.android.com/reference/kotlin/androidx/biometric/PromptVerticalListContentView` class. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Fallback.DeviceCredential` | Device credential as the fallback. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationRequest.Biometric.Strength.Class2` | Class 2 (formerly Weak). |

## Extension functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity.https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)( resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)( resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity.https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)( callbackExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html, resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)( callbackExecutor: https://developer.android.com/reference/java/util/concurrent/Executor.html, resultCallback: https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback )` Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |

## Extension functions

### ComponentActivity.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult) Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
fun ComponentActivity.registerForAuthenticationResult(
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the main thread.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Activity.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.activity.ComponentActivity
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.AuthenticationResultCallback
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult

class MyActivityForBiometricAuth : ComponentActivity() {
    val requestAuthentication =
        registerForAuthenticationResult(
            object : AuthenticationResultCallback {
                override fun onAuthResult(result: AuthenticationResult) {
                    when (result) {
                        // Handle successful authentication
                        is AuthenticationResult.Success -> {
                            Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                        }
                        // Handle authentication error, e.g. user cancellation, lockout errors,
                        // etc
                        is AuthenticationResult.Error -> {
                            Log.i(
                                TAG,
                                "onAuthenticationError " +
                                    "with error code: ${result.errorCode} " +
                                    "and error string: ${result.errString}",
                            )
                        }
                        // Handle fallback option clicks
                        is AuthenticationResult.CustomFallbackSelected -> {
                            Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                        }
                    }
                }

                // Handle intermediate authentication failure, this is optional and
                // not needed in most cases
                override fun onAuthAttemptFailed() {
                    Log.i(TAG, "onAuthenticationFailed, try again")
                }
            }
        )

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(this).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)` | (Executor, AuthenticationResultCallback) |

### Fragment.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult) Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
fun Fragment.registerForAuthenticationResult(
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the main thread.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Fragment.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult
import androidx.fragment.app.Fragment

class MyFragmentForBiometricAuth : Fragment() {
    val requestAuthentication =
        registerForAuthenticationResult { result: AuthenticationResult ->
            when (result) {
                // Handle successful authentication
                is AuthenticationResult.Success -> {
                    Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                }
                // Handle authentication error, e.g. user cancellation, lockout errors, etc
                is AuthenticationResult.Error -> {
                    Log.i(
                        TAG,
                        "onAuthenticationError " +
                            "with error code: ${result.errorCode} " +
                            "and error string: ${result.errString}",
                    )
                }
                // Handle fallback option clicks
                is AuthenticationResult.CustomFallbackSelected -> {
                    Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                }
            }
        }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(context).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)` | (Executor, AuthenticationResultCallback) |

### ComponentActivity.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult) Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
fun ComponentActivity.registerForAuthenticationResult(
    callbackExecutor: Executor,
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the thread provided by the `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.activity.ComponentActivity).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Activity.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.activity.ComponentActivity
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.AuthenticationResultCallback
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult

class MyActivityForBiometricAuth : ComponentActivity() {
    val requestAuthentication =
        registerForAuthenticationResult(
            object : AuthenticationResultCallback {
                override fun onAuthResult(result: AuthenticationResult) {
                    when (result) {
                        // Handle successful authentication
                        is AuthenticationResult.Success -> {
                            Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                        }
                        // Handle authentication error, e.g. user cancellation, lockout errors,
                        // etc
                        is AuthenticationResult.Error -> {
                            Log.i(
                                TAG,
                                "onAuthenticationError " +
                                    "with error code: ${result.errorCode} " +
                                    "and error string: ${result.errString}",
                            )
                        }
                        // Handle fallback option clicks
                        is AuthenticationResult.CustomFallbackSelected -> {
                            Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                        }
                    }
                }

                // Handle intermediate authentication failure, this is optional and
                // not needed in most cases
                override fun onAuthAttemptFailed() {
                    Log.i(TAG, "onAuthenticationFailed, try again")
                }
            }
        )

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(this).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```

### Fragment.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult) Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
fun Fragment.registerForAuthenticationResult(
    callbackExecutor: Executor,
    resultCallback: AuthenticationResultCallback
): AuthenticationResultLauncher
```

Returns an `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/kotlin/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the thread provided by the `https://developer.android.com/reference/kotlin/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Fragment.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult
import androidx.fragment.app.Fragment

class MyFragmentForBiometricAuth : Fragment() {
    val requestAuthentication =
        registerForAuthenticationResult { result: AuthenticationResult ->
            when (result) {
                // Handle successful authentication
                is AuthenticationResult.Success -> {
                    Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                }
                // Handle authentication error, e.g. user cancellation, lockout errors, etc
                is AuthenticationResult.Error -> {
                    Log.i(
                        TAG,
                        "onAuthenticationError " +
                            "with error code: ${result.errorCode} " +
                            "and error string: ${result.errString}",
                    )
                }
                // Handle fallback option clicks
                is AuthenticationResult.CustomFallbackSelected -> {
                    Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                }
            }
        }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(context).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```