Skip to main content

Implementing the callback

When you call the startIdentification method, you need to pass an AutomatIdCallback object.


For Android, it is recommended to use the AutomatIdLifecycleCallback subclass, that will ensure that its methods are invoked according to the lifecycle of the provided lifecycleOwner (e.g. fragment), that is, only when your calling activity or fragment is brought back to the started state.

This is necessary, for example, to perform a fragment transaction or a navigation with Jetpack Navigation (androidx.navigation).

AutomatIdManager.startIdentification(requireActivity(), identificationRequest, object : AutomatIdLifecycleCallback(this /* fragment */) {
override fun onSuccess_(result: AutomatIdIdentificationResult.Success) {

override fun onCancel_() {
// no op

override fun onError_(error: AutomatIdIdentificationResult.Error) {
// Unrecoverable errors will always abort the identification flow, so we show a feedback screen.

override fun decideRecoverableErrorHandling(error: AutomatIdIdentificationResult.Error): ErrorHandlingDecision {
return ErrorHandlingDecision.RETRY_IDENTIFICATION