# BiometricPrompt.AuthenticationCallback

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# AuthenticationCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback "View this page in Java")  

```
abstract class AuthenticationCallback
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                           ||
| ↳ | [android.hardware.biometrics.BiometricPrompt.AuthenticationCallback](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#) |

Callback structure provided to[BiometricPrompt.authenticate(CancellationSignal,](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback))or[BiometricPrompt.authenticate(CryptoObject,](https://developer.android.com/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.

## Summary

|                                                                                Public constructors                                                                                 ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [AuthenticationCallback](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#AuthenticationCallback())`()` <br /> |

|                                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationError](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#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. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationFailed](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationFailed())`()` Called when a biometric is valid but not recognized.                                                                                                                                                                                                                                                                          |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationHelp](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#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.              |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAuthenticationSucceeded](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(android.hardware.biometrics.BiometricPrompt.AuthenticationResult))`(`result:` `[BiometricPrompt.AuthenticationResult](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationResult)!`)` Called when a biometric is recognized.                                              |

## Public constructors

### AuthenticationCallback

```
AuthenticationCallback()
```

## Public methods

### onAuthenticationError

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):An integer identifying the error message                                     |
| `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 |

### onAuthenticationFailed

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAuthenticationFailed(): Unit
```

Called when a biometric is valid but not recognized.  

### onAuthenticationHelp

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):An integer identifying the error message                               |
| `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 |

### onAuthenticationSucceeded

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult!): Unit
```

Called when a biometric is recognized.

|                                                                                                     Parameters                                                                                                      ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `result` | [BiometricPrompt.AuthenticationResult](https://developer.android.com/reference/kotlin/android/hardware/biometrics/BiometricPrompt.AuthenticationResult)!:An object containing authentication-related data |