Skip to main content

Logging

The SDK provides a way to log user and SDK common actions (lifecycle events, navigation, camera changes). This can be useful for understanding specific scenarios or troubleshooting potential issues. To enable logging, provide your implementation of the IdenfyLoggingHandlerUseCase class:
  val consoleLogging = ConsoleLoggingImpl()
  IdenfyController.getInstance().idenfyLoggingHandler = IdenfyLoggingHandlerUseCaseImpl(consoleLogging)
  class ConsoleLoggingImpl {
    fun log(event: String, message: String, token: String) {
        Log.d("fromIdenfySDK-$event", message)
    }
}
 class IdenfyLoggingHandlerUseCaseImpl(private var consoleLoggingImpl: ConsoleLoggingImpl):IdenfyLoggingHandlerUseCase {
    override fun logEvent(event: String, message: String, token: String) {
        consoleLoggingImpl.log(event, message, token)
    }
}
You only need to provide a concrete implementation of the IdenfyLoggingHandlerUseCase interface. If you also want to see OkHttp requests/responses and payload in Logcat, initialize the iDenfy SDK with IdenfySDKLoggingEnum.FULL:
val idenfySettingsV2 = IdenfySettingsV2.IdenfyBuilderV2()
                .withAuthToken(authToken)
                .withLogging(IdenfySDKLoggingEnum.FULL)
                .build()

User events webhooks (optional)

The SDK provides webhooks about events occurring throughout the verification process. Results are delivered while the verification process is active and the application is presenting SDK views.

Declare a class for receiving events

Declare a class that implements IdenfyUserFlowHandler to call your backend service, log events, or apply changes:
class IdenfyUserFlowCallbacksHandler : IdenfyUserFlowHandler {
    /**
     * @param documentType Selected document type
     */
    override fun onDocumentSelected(documentType: String) {
        Log.d("onDocumentSelected", documentType)
    }

    /**
     * @param issuingCountryCode Selected issuingCountryCode
     */
    override fun onCountrySelected(issuingCountryCode: String) {
        Log.d("onCountrySelected", issuingCountryCode)
    }

    /**
     * @param photosUploaded indicated that photos have been uploaded
     */
    override fun onPhotosUploaded(photosUploaded: Boolean) {
        Log.d("onPhotosUploaded", photosUploaded.toString())
    }

    /**
     * @param processingStarted indicates that processing has started
     */
    override fun onProcessingStarted(processingStarted: Boolean) {
        Log.d("onProcessingStarted", processingStarted.toString())
    }
}

Configure application class

Set IdenfyUserFlowController to reference idenfyUserFlowCallbacksHandler in the application class:
class IdenfyApplication : MultiDexApplication() {
    override fun onCreate() {
        super.onCreate()
        val idenfyUserFlowCallbacksHandler =
            IdenfyUserFlowCallbacksHandler()
        IdenfyUserFlowController.setIdenfyUserFlowHandler(idenfyUserFlowCallbacksHandler)
    }
}
You must set the webhooks handler in the application class to ensure that the listener is set again after the application process has stopped.