References
This page contains references for possible error codes, object structure, etc. Most of this can be obtained from the javadoc/clicking into code via Android Studio, but it is also provided here as a reference.
Document Camera Result
Whether the Document Camera was launched via activity or via composition, its success case result is returned as a DocumentProcessingState.Result.
sealed interface Result : DocumentProcessingState
/**
* Exception received during processing or configuration change.
*
* [message], [component], and [cause] are mostly provided for backwards compatibility. At a
* future point this class may be simplified to only contain the [smartCaptureException].
*
* @param message error description if available
* @param component component which caused error to happen
* @param cause exception which caused error to happen
* @param smartCaptureException if the failure was internally tracked via
* [SmartCaptureException], this field will hold it. In most cases this will be the same as
* [cause].
*/
data class Failure(
@Deprecated("Use smartCaptureException.message instead")
val message: String = "",
@Deprecated("Use smartCaptureException.errorCode instead")
val component: ErrorComponent = ErrorComponent.Other,
@Deprecated("Use smartCaptureException.cause instead")
val cause: Throwable? = null,
val smartCaptureException: SmartCaptureException? = null
) : Result
/**
* Document captured successfully by analyzing camera feed or taking a picture
*
* @param bytes bytes representing the captured document JPEG image
* @param previewBitmap a bitmap intended for preview/user review, but not for validation or data extraction
* @param method capture method
*/
data class Success(
val bytes: ByteArray,
val previewBitmap: Bitmap,
val method: CaptureMethod
) : Result
The bytes hold a raw JPEG image as a byte array, while the previewBitmap is a bitmap representation of the image that can be presented to the user for validation. When sending an image to a server for processing, please make sure to use the bytes rather than the previewBitmap.