Stay organized with collections
Save and categorize content based on your preferences.
AuthenticationCallback
abstract class AuthenticationCallback
Callback structure provided to BiometricPrompt.authenticate(CancellationSignal,
or BiometricPrompt.authenticate(CryptoObject,
. Users must provide an implementation of this for listening to authentication events.
Summary
Public methods |
open Unit |
Called when an unrecoverable error has been encountered and the operation is complete.
|
open Unit |
Called when a biometric is valid but not recognized.
|
open Unit |
Called when a recoverable error has been encountered during authentication.
|
open Unit |
Called when a biometric is recognized.
|
Public constructors
AuthenticationCallback
AuthenticationCallback()
Public methods
onAuthenticationError
open fun onAuthenticationError(
errorCode: Int,
errString: CharSequence!
): Unit
Called when an unrecoverable error has been encountered and the operation is complete. No further actions will be made on this object.
Parameters |
errorCode |
Int: An integer identifying the error message |
errString |
CharSequence!: A human-readable error string that can be shown on an UI |
onAuthenticationFailed
open fun onAuthenticationFailed(): Unit
Called when a biometric is valid but not recognized.
onAuthenticationHelp
open fun onAuthenticationHelp(
helpCode: Int,
helpString: CharSequence!
): Unit
Called when a recoverable error has been encountered during authentication. The help string is provided to give the user guidance for what went wrong, such as "Sensor dirty, please clean it."
Parameters |
helpCode |
Int: An integer identifying the error message |
helpString |
CharSequence!: A human-readable string that can be shown on an UI |
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 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# BiometricPrompt.AuthenticationCallback\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAuthenticationCallback\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback \"View this page in Java\") \n\n```\nabstract class AuthenticationCallback\n```\n\n|---|-------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.biometrics.BiometricPrompt.AuthenticationCallback](#) |\n\nCallback structure provided to [BiometricPrompt.authenticate(CancellationSignal,](/reference/kotlin/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)) or [BiometricPrompt.authenticate(CryptoObject,](/reference/kotlin/android/hardware/biometrics/BiometricPrompt#authenticate(android.hardware.biometrics.BiometricPrompt.CryptoObject,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)). Users must provide an implementation of this for listening to authentication events.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------|---|\n| [AuthenticationCallback](#AuthenticationCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationError](#onAuthenticationError(kotlin.Int,%20kotlin.CharSequence))`(`errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `errString:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Called when an unrecoverable error has been encountered and the operation is complete. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationFailed](#onAuthenticationFailed())`()` Called when a biometric is valid but not recognized. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationHelp](#onAuthenticationHelp(kotlin.Int,%20kotlin.CharSequence))`(`helpCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `helpString:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Called when a recoverable error has been encountered during authentication. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationSucceeded](#onAuthenticationSucceeded(android.hardware.biometrics.BiometricPrompt.AuthenticationResult))`(`result:` `[BiometricPrompt.AuthenticationResult](/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationResult)!`)` Called when a biometric is recognized. |\n\nPublic constructors\n-------------------\n\n### AuthenticationCallback\n\n```\nAuthenticationCallback()\n```\n\nPublic methods\n--------------\n\n### onAuthenticationError\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAuthenticationError(\n errorCode: Int, \n errString: CharSequence!\n): Unit\n```\n\nCalled when an unrecoverable error has been encountered and the operation is complete. No further actions will be made on this object.\n\n| Parameters ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `errorCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): An integer identifying the error message |\n| `errString` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: A human-readable error string that can be shown on an UI |\n\n### onAuthenticationFailed\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAuthenticationFailed(): Unit\n```\n\nCalled when a biometric is valid but not recognized. \n\n### onAuthenticationHelp\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAuthenticationHelp(\n helpCode: Int, \n helpString: CharSequence!\n): Unit\n```\n\nCalled when a recoverable error has been encountered during authentication. The help string is provided to give the user guidance for what went wrong, such as \"Sensor dirty, please clean it.\"\n\n| Parameters ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `helpCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): An integer identifying the error message |\n| `helpString` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: A human-readable string that can be shown on an UI |\n\n### onAuthenticationSucceeded\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult!): Unit\n```\n\nCalled when a biometric is recognized.\n\n| Parameters ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `result` | [BiometricPrompt.AuthenticationResult](/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationResult)!: An object containing authentication-related data |"]]