Skip to main content

Android SDK

Integrate the TrustPlatform Android SDK into your Android app

Requirements

RequirementMinimum version
Android API24 (Android 7.0)
Kotlin2.x

Installation

1. Add the Maven repository

Add the following to your settings.gradle.kts:

dependencyResolutionManagement {
repositories {
maven { url = uri("https://raw.githubusercontent.com/idnow/idnow-android-sdk/main") }
}
}

2. Add the dependency

Use the BOM to keep module versions in sync:

// build.gradle.kts
dependencies {
implementation(platform("io.idnow.trustplatform:bom:<version>"))
implementation("io.idnow.trustplatform:core")
}

Register for Results

Call TrustPlatformSession.registerForResult in onCreate(), before the activity reaches onStart():

class MainActivity : ComponentActivity() {

private lateinit var launcher: ActivityResultLauncher<TrustPlatformConfig>

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

launcher = TrustPlatformSession.registerForResult(this) { result ->
when (result) {
is TrustPlatformResult.Completed -> {
// The flow completed. Query your backend for the outcome.
// See https://docs.eu.platform.idnow.io/docs/integration/get-session-results
}
is TrustPlatformResult.Cancelled -> { /* user cancelled */ }
is TrustPlatformResult.Failed -> { /* result.message contains details */ }
}
}
}
}

Configure the SDK

Pass a TrustPlatformEnvironment when you launch a session.

EnvironmentDescription
TrustPlatformEnvironment.ProductionThe production environment
TrustPlatformEnvironment.SandboxThe sandbox environment for development and testing (default)

Configure Permissions

Add the following to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

Launch a Session

Create a session via the API, then launch the SDK with the session token:

launcher.launch(
TrustPlatformConfig(
token = token,
environment = TrustPlatformEnvironment.Production,
)
)

Handle Results

VariantWhen it occurs
CompletedThe user completed the verification flow
CancelledThe user cancelled the flow
Failed(message)The flow failed; message contains details

Completed only signals that the flow finished. To retrieve the actual outcome, query the Get session results API endpoint using the sessionId you received when creating the session.

result.message contains a human-readable description of the failure, suitable for logging.

launcher = TrustPlatformSession.registerForResult(this) { result ->
when (result) {
is TrustPlatformResult.Completed -> {
// The flow completed. Query your backend for the outcome.
// See https://docs.eu.platform.idnow.io/docs/integration/get-session-results
}
is TrustPlatformResult.Cancelled -> { /* user cancelled the flow */ }
is TrustPlatformResult.Failed -> { /* log result.message */ }
}
}

DocIDV Handler (Optional)

Add the Dependency

// build.gradle.kts
dependencies {
implementation(platform("io.idnow.trustplatform:bom:<version>"))
implementation("io.idnow.trustplatform:core")
implementation("io.idnow.trustplatform:docidv")
}
note

NFC permissions for eID scanning are included automatically via manifest merging from the DocIDV handler's dependencies. No additional NFC entries are required in your manifest.

How It Works

When you add trustplatform-docidv to your dependencies, the SDK discovers the DocIDV handler automatically at runtime via ServiceLoader — no registration call is required. If the dependency is absent, the SDK runs the DocIDV step in the webview instead.