To get the DocumentDetectorResult object, which contains the captures taken by the SDK, override the onActivityResult method in the same Activity that you started the DocumentDetectorActivity.
overridefunonActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {super.onActivityResult(requestCode, resultCode, data)if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {val result =data?.getSerializableExtra( DocumentDetectorResult.PARAMETER_NAME ) as DocumentDetectorResultif (!result.wasSuccessful()) { result.sdkFailure?.let {onSdkFailure(it) }return }println("DocumentDetectorResult: $result") } else {println("The user canceled the operation") }super.onActivityResult(requestCode, resultCode, data) }privatefunonSdkFailure(sdkFailure: SDKFailure?) {when (sdkFailure) {is InvalidTokenReason -> {println("SDKFailure: The token entered as a parameter is not valid, please revise it") }is PermissionReason -> {println("SDKFailure: The user did not grant the necessary permissions") }is AvailabilityReason -> {println("SDKFailure: Instructions are sent in: ${sdkFailure.message}") }is NetworkReason -> {println("SDKFailure: There was a problem with the internet connection") }is ServerReason -> {println("SDKFailure: There was a problem in any communication with the CAF servers, let us know!") }is SecurityReason -> {println("SDKFailure: There was a security problem on the user's device") }is StorageReason -> {println("SDKFailure: There was a problem with the internal storage of the user's device") }is LibraryReason -> {println("SDKFailure: There was a problem with the internal library") }else-> {println("SDKFailure: Unknown reason") } } }