---
title: Liveness (biometric selfie)
canonical: https://developer.unico.io/dual-api/developers/sdks-and-tools/android/capture-flow/capture-types/liveness
locale: en
generated_by: markdown-export
---

Biometric selfie capture with embedded liveness verification. The SDK guides the user until a biometrically valid frame is obtained via SmartFrames and returns the image as Base64 + JWT (JSON Web Token — a signed payload sent to your backend to call the REST API).

:::secondary[Capability]
This capture type uses the **Liveness** capability. For a conceptual overview of how Liveness works, refer to the [Liveness capability page](/capabilities/liveness).
:::

## How it works

The SDK manages the full capture session:

1. Opens the camera with the SmartFrame overlay.
2. Guides the user to position their face within the frame.
3. Validates liveness — the session only completes when the user is physically present.
4. Returns a `ResultCamera` object with `base64` and `encrypted` (JWT).

## Starting a liveness capture

****Step 2** — Implement `iAcessoBioSelfie`**

`iAcessoBioSelfie` handles the selfie capture result callbacks:

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

  :::warning[Token expiry]
  The interval between generating `encrypted` and submitting it to the API must not exceed **10 minutes**.
  :::

  ### Kotlin

    ```kotlin
    val selfieListener = object : iAcessoBioSelfie {
      override fun onSuccessSelfie(result: ResultCamera?) { }
      override fun onErrorSelfie(errorBio: ErrorBio?) { }
    }
    ```

### Java

    ```java
    iAcessoBioSelfie selfieListener = new iAcessoBioSelfie() {
      @Override
      public void onSuccessSelfie(ResultCamera result) { }

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

****Step 3** — Call `prepareCamera`**

With `unicoCheckCamera` initialized and both listeners implemented, call `prepareCamera` passing the SDK config (the `UnicoConfig` created in [Initialization](/developers/sdks-and-tools/android/initialization)) and a `SelfieCameraListener`:

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

  ### Kotlin

    ```kotlin
    unicoCheckCamera
      .prepareCamera(UnicoConfig(), object : SelfieCameraListener {
        override fun onCameraReady(cameraOpener: UnicoCheckCameraOpener.Selfie?) {
          cameraOpener?.open(selfieListener)
        }
        override fun onCameraFailed(message: String?) { }
      })
    ```

### Java

    ```java
    unicoCheckCamera
      .prepareCamera(new UnicoConfig(), new SelfieCameraListener() {
        @Override
        public void onCameraReady(UnicoCheckCameraOpener.Selfie cameraOpener) {
          cameraOpener.open(selfieListener);
        }

        @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).