Skip to main content
The Youverify Android SDK lets you add anti-deepfake liveness detection directly to your Android application using Jetpack Compose. Users perform a brief head-movement task that proves a live person — not a photo, video, or deepfake — is present. Before launching the SDK you must generate two server-side tokens (a session ID and a liveness token) to authenticate the session securely.

Current version

The latest Android Liveness SDK version is 0.0.12.

Prerequisites

  • Android minimum SDK: API level 24 (Android 7.0)
  • Jetpack Compose enabled in your project
  • CAMERA permission declared in your AndroidManifest.xml

Step 1 — Add the dependency

Add the Youverify Liveness SDK to your app module’s build.gradle.kts:
Also add the ABI filter configuration to support the required native architectures:

Step 2 — Declare the camera permission

Add the following to your AndroidManifest.xml:
Request the permission at runtime before launching the SDK if your app targets API level 23 or higher.

Step 3 — Generate tokens server-side

Before initializing the SDK you need two tokens generated by your backend. Neither token should be generated in your Android app. Generate session ID — call POST /v2/api/sdk/session-id:
Generate liveness token — call POST /v2/api/sdk/liveness-token:
Never embed your API secret key (apiToken) in your Android app. Make these calls from your server and deliver only the resulting sessionId and authToken to the app.

Step 4 — Initialize and launch the SDK

Once you have the sessionId and sessionToken from your backend, initialize the SDK in a Composable:

Available liveness tasks

The SDK supports four task types. Pass them to livenessController.start(tasks = listOf(...)):

Callback data

Both onSuccess and onFailure receive a LivenessData object:
boolean
true if the liveness check passed.
string
Base64-encoded face image captured during the check.
string
Video clip of the user performing the liveness task.
object
Present only in failure cases. Contains key (e.g. eyes_closed, image_capture_failed, invalid_or_expired_session) and message.

Configuration options

string
Your Youverify public merchant key. Safe to embed in your app.
string
required
Session ID generated server-side via POST /v2/api/sdk/session-id.
string
required
Liveness auth token generated server-side via POST /v2/api/sdk/liveness-token.
boolean
default:"true"
Set to false for production. Defaults to true (sandbox mode).
SDKUser
User details for the liveness session. firstName is required; lastName and email are optional.
boolean
default:"false"
Set to true to narrate task instructions to the user via audio.

Supported document types

When using the Document Capture SDK for Android alongside the Liveness SDK, the following document types are supported for capture: passports, national identity cards, driver’s licences, and residence permits. For a full list of supported countries and document types, see the SDKs overview.
Session tokens expire after a short period. If you receive an invalid_or_expired_session error, generate fresh sessionId and sessionToken values from your backend and re-initialize the SDK.