---
title: Document capture
canonical: https://developer.unico.io/dual-api/developer/sdks-and-tools/android-sdk/document-capture/
locale: en
generated_by: markdown-export
---

Capture of identity documents. Supports **RG** (front only or front and back), **CNH** (front and back), and **CPF**, when combined with the [Document Capture and Reuse](/capabilities/document-reuse-and-capture) capability.

For the full list of supported document types and their enum values, see [API Reference > Enums](/developers/sdks-and-tools/android/api-reference/enums).

## Starting a document capture

****Step 2** — Implement `iAcessoBioDocument`**

`iAcessoBioDocument` handles the document capture result callbacks:

  | Method | Description |
  |---|---|
  | `onSuccessDocument(result)` | Capture succeeded — returns `ResultCamera` with `base64` (preview) and `encrypted` (JWT for the API) |
  | `onErrorDocument(errorBio)` | Capture failed — returns an `ErrorBio` with code and description |

  ### Kotlin

    ```kotlin
    val documentListener = object : iAcessoBioDocument {
      override fun onSuccessDocument(result: ResultCamera?) { }
      override fun onErrorDocument(errorBio: ErrorBio?) { }
    }
    ```

### Java

    ```java
    iAcessoBioDocument documentListener = new iAcessoBioDocument() {
      @Override
      public void onSuccessDocument(ResultCamera result) { }

      @Override
      public void onErrorDocument(ErrorBio errorBio) { }
    };
    ```

****Step 3** — Call `prepareDocumentCamera`**

With `acessoBioBuilder` initialized and both listeners implemented, call `prepareDocumentCamera` passing the SDK config (the `UnicoConfig` created in [Initialization](/developers/sdks-and-tools/android/initialization)), the desired `DocumentType`, and a `DocumentCameraListener`:

  - `onCameraReady` — camera is ready; call `open` passing the `documentListener` from Step 2.
  - `onCameraFailed` — camera preparation failed; handle the error message.

  ### Kotlin

    ```kotlin
    acessoBioBuilder
      .build()
      .prepareDocumentCamera(UnicoConfig(), DocumentType.CNH, object : DocumentCameraListener {
        override fun onCameraReady(cameraOpener: UnicoCheckCameraOpener.Document?) {
          cameraOpener?.open(documentListener)
        }
        override fun onCameraFailed(message: String?) { }
      })
    ```

### Java

    ```java
    acessoBioBuilder
      .build()
      .prepareDocumentCamera(new UnicoConfig(), DocumentType.CNH, new DocumentCameraListener() {
        @Override
        public void onCameraReady(UnicoCheckCameraOpener.Document cameraOpener) {
          cameraOpener.open(documentListener);
        }

        @Override
        public void onCameraFailed(String message) { }
      });
    ```

For the full result handling, see [Receiving the result](/developers/sdks-and-tools/android/capture-flow/receiving-the-result).