Android SDK

Prerequisites

Before integrating the SDK, ensure your development environment meets the following requirements:

  • Android Studio version: Narwhal
  • Android Minimum API Level: 26
  • Android Target API Level: 36
  • Gradle version: 8.14.3

Adding the SDK to Your Project

1

Add the following to your project-level build.gradle file:

1allprojects {
2 repositories {
3 google()
4 mavenCentral()
5 maven {
6 name = "IDmeSDK"
7 url = uri("https://maven.pkg.github.com/idme/idme-mobilesdk-artifacts")
8 credentials {
9 username = providers.gradleProperty("github.user").get()
10 password = providers.gradleProperty("github.token").get()
11 }
12 }
13 }
14}
2

Add the following to your app-level build.gradle file:

1dependencies {
2 implementation 'me.id.sdk:idme-sdk-android:<version>' // latest version is 0.8.0
3}
3

Sync your Gradle project

Required App Integration Steps

1

Our SDK will automatically request the permissions that it needs. If your application explicitly removes permissions, please ensure that CAMERA and RECORD_AUDIO are not removed.

2

Our SDK automatically requests and uses FOREGROUND_SERVICE_DATA_SYNC. You must declare the foreground service information within the Play Console (it is located under Policy -> App Content -> Foreground Service Permissions). Please follow the instructions outlined by Google Play here to ensure your application is compliant. These steps are:

  1. Provide a description of the app functionality that is using each foreground service type. You may supply the following description: “Our application uses the foreground service to upload end-user data to our servers for verification purposes”.
  2. Describe the user impact if the task is deferred by the system (does not start immediately) or the task is interrupted by the system (paused or restarted). You may supply the following description: “If the task is deferred or interrupted by the system, the end-user verification will be delayed”.
  3. Include a link to a video demonstrating each foreground service feature. You may record a video of the verification flow and provide a link to this video.
  4. Choose your specific use case for each foreground service type. You may select the following use case: “Network Transfer: Upload or Download / Other”.
3

Within the app level build.gradle, you will need to add the following entry:

1android {
2 manifestPlaceholders["appAuthRedirectScheme"] = "<insert package name>"
3}

Initialization

To initialize the SDK, create a subclass of the Application class, and add the following code to your onCreate() method:

1class SampleApp : Application() {
2 override fun onCreate() {
3 super.onCreate()
4 IDmeSDK.init(this.applicationContext, sdkConfig)
5 }
6}

You will need to pass in an instance of IDMeSDKConfig while initializing the SDK. This example demonstrates how to create this config:

1val sdkConfig = IDmeSDKConfig(
2 externalUserId = "sample-user-id", // Unique identifier for the user
3 appName = "SampleApp", // Name of the app
4 tokenProvider = ::tokenProvider
5)

The tokenProvider in the example is responsible for generating the client access token. This token enables the SDK to make REST API requests to ID.me’s backend APIs. The application must obtain a client access token from ID.me and provide a function to generate a new token if the current one expires. The SDK will then automatically use this to make REST API requests. This example illustrates the signature of this token provider method:

1suspend fun tokenProvider(): String = withContext(Dispatchers.IO) {
2 // Fetch client token from the backend and return it
3}

Common Usage Patterns

This section provides examples of common tasks you can perform with our Mobile SDK.

This section details the process of legal document verification utilizing our Mobile SDK. Initiating a verification is straightforward, as demonstrated by the code snippets below.

1idmeSDK.verificationsManager.beginVerification(VerificationType.DOCUMENT)

Once the verification is complete, you will receive a result, which contains the following fields:

1VerificationResult {
2 verificationId: // The ID of the verification
3 verificationStatus: // The status of the verification
4 errorCode: // Error code if the verification failed, null otherwise
5 errorMessage: // Error message if the verification failed, null otherwise
6 credentialId: // ID that can be used to fetch the document from ID.me's credentials REST API endpoint, null if the verification failed
7}

Checking the Status of an Ongoing Verification

This section describes how to obtain the status of an ongoing verification.

1// Returns the verificationID and status of all the ongoing verifications
2idmeSDK.verificationsManager.getAllVerifications()

Customizing the Document Scanner User Interface

This section details how to customize the document scanner’s user interface. While default values are based on ID.me’s design system, you have the flexibility to replace any or all of these to align with your application’s aesthetic. We provide customization options for the following elements:

  • Colors: Modify the color scheme of various interface elements.
  • Button Radius: Control the roundness of buttons within the Mobile SDK.
  • Logo: Replace the default ID.me logo with your application’s logo.
  • Fonts: Choose the fonts used for all text displayed in the document scanner interface.
The following optional fields are available for customization
1idmeSDK.verificationsManager.setDocScanUIConfig(
2 DocScanUIConfig(
3 colors = DocScanColors(
4 background = Color(<insert hex>).toArgb(),
5 onBackground = Color(<insert hex>).toArgb(),
6 onBackgroundSecondary = Color(<insert hex>).toArgb(),
7 onBackgroundTertiary = Color(<insert hex>).toArgb(),
8 primary = Color(<insert hex>).toArgb(),
9 onPrimary = Color(<insert hex>).toArgb(),
10 secondary = Color(<insert hex>).toArgb(),
11 onSecondary = Color(<insert hex>).toArgb(),
12 cameraOverlay = Color(<insert hex>).toArgb(),
13 onCameraOverlay = Color(<insert hex>).toArgb(),
14 outline = Color(<insert hex>).toArgb(),
15 success = Color(<insert hex>).toArgb(),
16 error = Color(<insert hex>).toArgb()
17 ),
18 buttonRadius = <insert button radius>,
19 logo = <insert logo>,
20 fonts = DocScanFonts(
21 regular = <insert font>,
22 medium = <insert font>,
23 bold = <insert font>
24 )
25 )
26)

Support

If you encounter any issues or have questions, please contact our developer support team. You can reach us at mobile-sdk-issues@id.me.