Android SDK

Coming Soon Kotlin / Java API 24+

Coming Soon — The Android SDK is under development. In the meantime, you can use a WebView with the JavaScript SDK or launch the verification URL with CustomTabsIntent.

The Android SDK (io.xident:sdk) will provide a native Kotlin-first experience for embedding age verification in Android apps. It uses Chrome Custom Tabs for the verification flow and deep links for the callback.

Installation

Gradle (Kotlin DSL)

// build.gradle.kts
dependencies {
    implementation("io.xident:sdk:1.0.0")
}

Maven

<!-- pom.xml -->
<dependency>
    <groupId>io.xident</groupId>
    <artifactId>sdk</artifactId>
    <version>1.0.0</version>
</dependency>

Quick Start

// MainActivity.kt
import io.xident.sdk.Xident
import io.xident.sdk.XidentConfig
import io.xident.sdk.VerificationResult

class MainActivity : AppCompatActivity() {
    private val xident = Xident(
        config = XidentConfig(
            apiKey = "pk_live_your_api_key",
            callbackScheme = "yourapp"  // yourapp://verified
        )
    )

    fun startVerification() {
        xident.start(
            activity = this,
            userId = "user-123",
            metadata = mapOf("plan" to "premium")
        )
    }

    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        // Handle callback: yourapp://verified?token=tok_xxx&status=success
        val token = intent.data?.getQueryParameter("token")
        val status = intent.data?.getQueryParameter("status")

        if (status == "success" && token != null) {
            // Send token to your backend for server-side verification
            verifyTokenOnBackend(token)
        }
    }
}

Jetpack Compose

// VerifyScreen.kt
@Composable
fun VerifyScreen(
    xident: Xident,
    userId: String
) {
    val context = LocalContext.current

    Button(
        onClick = {
            xident.start(
                activity = context as Activity,
                userId = userId
            )
        }
    ) {
        Text("Verify Your Age")
    }
}

Deep Link Setup

Register a deep link handler to receive the verification callback:

<!-- AndroidManifest.xml -->
<activity
    android:name=".MainActivity"
    android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="yourapp" android:host="verified" />
    </intent-filter>
</activity>

How It Works

  1. SDK opens Chrome Custom Tab to verify.xident.io with your API key
  2. User completes verification (liveness, age check, document if needed)
  3. Deep link callback returns the user to your app with yourapp://verified?token=tok_xxx
  4. Your backend verifies the token via the Xident REST API

WebView Alternative (Available Now)

While the native SDK is in development, you can use a WebView or Custom Tab to load the verification URL:

// Alternative: Use a WebView with the JavaScript SDK
val webView = WebView(context)
webView.settings.javaScriptEnabled = true
webView.loadUrl("https://verify.xident.io?api_key=pk_live_xxx&callback_url=yourapp://verified")

Requirements

Requirement Minimum
Android API24 (Android 7.0)
Kotlin1.8+
Gradle8.0+

Related