GitHub Repository
View source code and examples on GitHub
Native SDK: This is the recommended approach for Android apps. Native SDKs provide the best user experience, optimized camera handling, and full NFC support.
Requirements
| Requirement | Minimum Version |
|---|---|
| Android API | 23+ (Android 6.0 Marshmallow) |
| Kotlin | 1.9+ |
| Jetpack Compose | Included as transitive dependency |
Installation
Step 1: Add the Repository
Add the Didit Maven repository to therepositories block in your settings.gradle.kts:
settings.gradle (Groovy):
Step 2: Add the Dependency
Add the SDK dependency to your app’sbuild.gradle.kts:
build.gradle (Groovy):
Step 3: Add Packaging Exclusion
Add this to your app’sandroid block to avoid build conflicts:
Permissions
The SDK requires the following permissions. These are declared in the SDK’sAndroidManifest.xml and will be merged automatically into your app’s manifest:
| Permission | Description | Required |
|---|---|---|
INTERNET | Network access for API communication | ✅ Yes |
ACCESS_NETWORK_STATE | Detect network availability | ✅ Yes |
CAMERA | Document scanning and face verification | ✅ Yes |
NFC | Read NFC chips in passports/ID cards | ⚠️ If using NFC |
Camera and NFC Features
The SDK declaresandroid.hardware.camera and android.hardware.nfc as optional features (android:required="false"). This ensures your app can be installed on devices without a camera or NFC hardware — the SDK will gracefully handle missing hardware at runtime.
Quick Start
Step 1: Initialize the SDK
Initialize the SDK in yourApplication.onCreate():
Step 2: Start Verification and Handle Results
Integration Methods
The SDK supports two integration methods:Method 1: Session Token (Recommended for Production)
Create a session on your backend using the Create Verification Session API, then pass the token to the SDK:- Associating sessions with your users (
vendor_data) - Setting custom metadata
- Configuring callbacks per session
Method 2: Workflow ID (Simpler Integration)
For simpler integrations, the SDK can create sessions directly using your workflow ID:Configuration
Customize the SDK behavior:Configuration Options
| Property | Type | Default | Description |
|---|---|---|---|
languageLocale | SupportedLanguage? | Device locale | Force a specific language |
customIntroScreen | Boolean | false | Skip SDK’s intro screen (use your own) |
fontFamily | String? | System font | Custom font resource name (from res/font/) |
loggingEnabled | Boolean | false | Enable SDK debug logging |
Theming & Colors: Colors, backgrounds, and intro screen settings are configured through your White Label settings in the Didit Console, not in the SDK configuration. This ensures consistent branding across all platforms.
Language Support
The SDK supports 40+ languages. If no language is specified, the SDK uses the device locale with English as fallback.Advanced Options
Contact Details (Prefill & Notifications)
Provide contact details to prefill verification forms and enable email notifications:Expected Details (Cross-Validation)
Provide expected user details for automatic cross-validation with extracted document data:Custom Metadata
Store custom JSON metadata with the session (not displayed to user):Handling Results
TheVerificationResult sealed class provides the outcome of the verification:
Result Cases
| Case | Description |
|---|---|
Completed(session) | Verification flow completed (check session.status for result) |
Cancelled(session) | User cancelled the verification flow |
Failed(error, session) | An error occurred during verification |
SessionData Properties
| Property | Type | Description |
|---|---|---|
sessionId | String | Unique session identifier |
status | VerificationStatus | APPROVED, PENDING, or DECLINED |
Error Types
| Error | Description |
|---|---|
SessionExpired | The session has expired |
NetworkError | Network connectivity issue |
CameraAccessDenied | Camera permission not granted |
NotInitialized | SDK not initialized |
Unknown(message) | Other error with message |
Complete Result Handling Example
Observing SDK State
You can observe the SDK state for custom loading UI:ProGuard / R8
The SDK includes its own consumer ProGuard rules. No additional configuration is needed. If you use R8 full mode, you may need to add this to yourgradle.properties: