Installation¶
Using Zip files¶
- Create a new Android project (or use an existing one).
-
Import all provided
.aarlibraries into theapp/libsdirectory:The following libraries must be included:
genuine-ds-X.Y.Z.aar platform-common-definitions-X.Y.Z.aar platform-common-image-manipulation-X.Y.Z.aar platform-common-utils-X.Y.Z.aar platform-nativeds-X.Y.Z.aar sdk-camera-X.Y.Z.aar sdk-core-X.Y.Z.aar sdk-selfie-X.Y.Z.aar -
Add the SDK libraries to the app
build.gradledependencies:implementation(files("libs/genuine-ds-X.Y.Z.aar")) implementation(files("libs/platform-common-definitions-X.Y.Z.aar")) implementation(files("libs/platform-common-image-manipulation-X.Y.Z.aar")) implementation(files("libs/platform-common-utils-X.Y.Z.aar")) implementation(files("libs/platform-nativeds-X.Y.Z.aar")) implementation(files("libs/sdk-camera-X.Y.Z.aar")) implementation(files("libs/sdk-core-X.Y.Z.aar")) implementation(files("libs/sdk-selfie-X.Y.Z.aar")) -
Add the required Jetpack Compose dependencies.
The SDK UI is built using Jetpack Compose. Since local
.aarintegrations do not automatically expose all transitive dependency metadata, the host application must explicitly include the required Compose dependencies:implementation(platform("androidx.compose:compose-bom:<version>")) implementation("androidx.compose.material3:material3") implementation("androidx.activity:activity-compose:<version>") implementation("androidx.lifecycle:lifecycle-runtime-compose:<version>") implementation("androidx.lifecycle:lifecycle-viewmodel-compose:<version>") -
Add the required external dependencies:
implementation("com.google.mediapipe:tasks-vision:<version>") implementation("io.coil-kt:coil-compose:<version>") implementation("io.coil-kt:coil-gif:<version>") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:<version>") implementation("org.jetbrains.kotlin:kotlin-reflect:<version>") -
Use tested dependency versions
Dependency Compatible version Compose BOM 2025.06.00 Activity Compose 1.10.1 Lifecycle 2.8.7 Media Pipe 0.10.32 Coil Compose 2.6.0 Kotlinx Serialization JSON 1.6.3 Kotlin Reflect 1.9.25 Newer versions may work, but compatibility should be validated by the integrator. This is especially important for Jetpack Compose dependencies, where incompatible module versions may lead to runtime errors such as
NoSuchMethodErrororNoClassDefFoundError. -
Sync the project with Gradle and build the application.
android:largeHeap="true"is strongly recommended in the application manifest to improve memory availability during image processing flows.
Prepare the configuration¶
- Provide a
DocumentCaptureConfigurationinstance (you can build it in code or load it from a JSON). - Ensure camera permission is defined in
AndroidManifest.xml.
Minimal code usage¶
Import the SDK, create the configuration (programmatically or from JSON), and start the flow:
import androidx.activity.ComponentActivity
import com.veridas.sdk.selfie.entrypoint.SelfieCapture
import com.veridas.sdk.selfie.entrypoint.SelfieCaptureEventsListener
import com.veridas.sdk.selfie.entrypoint.SelfieCaptureListener
import com.veridas.sdk.selfie.error.SelfieCaptureError
import com.veridas.sdk.selfie.event.SelfieCaptureEvent
import com.veridas.sdk.selfie.result.SelfieCaptureResult
class SelfieIntegratorActivity :
ComponentActivity(),
SelfieCaptureListener,
SelfieCaptureEventsListener
{
private companion object {
private val TAG = SelfieIntegratorActivity::class.simpleName
}
fun startCapture() {
SelfieCapture.start(
listener = this,
configuration = getConfigurationFromAsset(fileName),
context = this
)
SelfieCapture.setEventsListener(this)
}
// SelfieCaptureListener
override fun onSelfieCaptureResults(results: SelfieCaptureResult) {
Log.i(TAG, "Selfie SDK -- onSelfieCaptureResults $results")
}
override fun onSelfieCaptureStarted() {
Log.i(TAG, "Selfie SDK -- Started")
}
override fun onChallengeTokenRequired() {
Log.i(TAG, "Selfie SDK -- onChallengeTokenRequired")
val freshChallengeToken = createNewChallengeToken()
SelfieCapture.setChallengeToken(freshChallengeToken)
}
override fun onSelfieCaptureFinished(error: SelfieCaptureError?) {
Log.i(TAG, "Selfie SDK -- onSelfieCaptureFinished $error")
}
// SelfieCaptureEventsListener
override fun onSelfieCaptureEvent(event: SelfieCaptureEvent) {
Log.i(TAG, "Selfie SDK -- onSelfieCaptureEvent $event")
}
}
Example helper for loading JSON configs (shared by all SDKs):
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json
@OptIn(ExperimentalSerializationApi::class)
private val json = Json {
ignoreUnknownKeys = true
explicitNulls = false
}
fun getConfigurationFromAsset(fileName: String): SelfieCaptureConfiguration {
val jsonString = applicationContext
.assets
.open(fileName)
.bufferedReader()
.use { it.readText() }
return json.decodeFromString<SelfieCaptureConfiguration>(jsonString)
}
SelfieCaptureListener covers onSelfieCaptureResults, onSelfieCaptureStarted, onChallengeTokenRequired and onSelfieCaptureFinished, while SelfieCaptureEventsListener can be implemented optionally to receive tracking events through onSelfieCaptureEvent. Details are in the API section.