Get started with Android SDK

Check requirements and begin your integration with the Android SDK.

Latest release: Version 1.47.0 (Changelog)

Requirements

Resources

Installation

  1. Add the Sumsub maven repository to the repositories section in your build.gradle file.
repositories {
  maven { url "https://maven.sumsub.com/repository/maven-public/" }
}
  1. Add the following dependencies to your build.gradle file.
dependencies {
    // Sumsub core
    implementation "com.sumsub.sns:idensic-mobile-sdk:$latestVersion"
    // Video Identification module
    implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:$latestVersion"
    // eID module
    implementation "com.sumsub.sns:idensic-mobile-sdk-eid:$latestVersion"  	
    // NFC module
    implementation "com.sumsub.sns:idensic-mobile-sdk-nfc:$latestVersion"
}

Initialization

🚧

Attention

Make sure you have configured your verification level and access token before initializing the SDK.

// use the 'accessToken' that you generated on your backend
val accessToken = "..."

val tokenExpirationHandler = object : TokenExpirationHandler {
    override fun onTokenExpired(): String? {
        val newToken = "..." // get a new token from your backend
        return newToken
    }
}

val snsSdk = SNSMobileSDK.Builder(this)
    .withAccessToken(accessToken, onTokenExpiration = tokenExpirationHandler)
    .withLocale(Locale("en"))
    .build()

snsSdk.launch()
📘

Note

Only one SDK instance can run at a time. Do not call launch() again until the previous instance has finished, i.e. until its completion handler has returned (see On SDK completion). Protect the code that starts the SDK against repeated calls (for example, a double tap on the start button).

To restart the SDK with different parameters, call dismiss() and wait for the completion handler. Build and launch the new instance only after the handler returns.

Dismissal

By default, once the applicant is approved, the SDK will be dismissed in 3 seconds automatically. You can adjust this time interval or switch the automatic dismissal off by setting the value to zero.

val snsSdk = SNSMobileSDK.Builder(this)
    ...
    .withAutoCloseOnApprove(0)
    .build()

Also, in case you need to close the SDK programmatically.

snsSdk.dismiss()

Configuration

Applicant Data

If it is required, you can provide an email and/or a phone number that will be initially assigned to the applicant.

val snsSdk = SNSMobileSDK.Builder(this)
    ...
    .withConf(SNSInitConfig(email = "...", phone = "..."))
    .build()

snsSdk.launch()

Preferred Documents

For IDENTITY* steps, it is possible to specify the preferred country and document type to be selected automatically, thereby bypassing the DocType Selector screen.

Note that the provided parameters will be applied only if the corresponding combination of country and idDocType is allowed at the step, according to the level configuration.

val snsSdk = SNSMobileSDK.Builder(this)
    ...
    .withPreferredDocumentDefinitions(mapOf(
        "IDENTITY" to SNSDocumentDefinition(idDocType = "DRIVERS", country = "USA")
    ))
    .build()

Forced Day/Night mode

If it's required, you can force Day or Night mode in the SDK.

This forces SDK to stop using system mode and use the defined option.

val snsSdk = SNSMobileSDK.Builder(this)
    ...
    .withForcedDayNightMode(DayNightMode.NIGHT) // DayNightMode.DAY
    .build()

Video identification

The VideoIdent is an optional module that is required only if you are going to use the Video identification during the verification flow.

To enable the module, add the following dependency to your build.gradle file.

dependencies {
    // Video Identification module
    implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:$latestVersion"
}

eID

The eID is an optional module that is required only if you are going to use the eID during the verification flow.

To access it, you first need to add the private repository to your settings.gradle file. You can obtain the credentials through our support team.

maven {
    url = "https://maven.sumsub.com/repository/maven-private/"
    credentials {
        username = "..."
        password = "..."
    }
}

To enable the module, add the following dependency to your build.gradle file.

dependencies {
    // eID module
    implementation "com.sumsub.sns:idensic-mobile-sdk-eid:$latestVersion"
}

NFC

Starting from MSDK 1.34.0, the NFC is an optional module that is required only if you are going to use the NFC during the verification flow.

To enable the module, add the following dependency to your build.gradle file.

dependencies {
    // NFC module
    implementation "com.sumsub.sns:idensic-mobile-sdk-nfc:$latestVersion"
}

Starting from MSDK 1.40.0 you might need to declare additional packaging entry in you build.gradle file.

android {
    packaging {
        resources.excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF"
    }
}

Device Intelligence

Fisherman module is included by default in the Sumsub Android SDK starting from version 1.43.0.

Fisherman is the SDK module that powers the Device Intelligence feature, which helps strengthen fraud detection during the verification flow.

If you do not use Device Intelligence, you can exclude the Fisherman module to reduce your app size. See Reducing app size for details.

Action Flow

To run the SDK in applicant actions mode, create an Applicant actions verification level. Then generate the access token with the level name as levelName, plus userId and externalActionId.

Beyond that, you manage the SDK as with regular levels.

File selection in gallery

You can specify the type of file requested from the gallery by overriding the resource string. The default value is image/*,application/pdf.

<string name="sns_gallery_type">*/*</string>

If the value is image/* or a single image type (for example, image/png), the system photo picker opens instead of the file picker on devices that support it.

Users can preview PDF files on Android devices running 5.0 Lollipop and higher.

Low-light performance for our liveness detection

The SDK can operate using screen light in low-light conditions. The application must have additional permissions to change screen brightness. Accordingly, you can request that the applicant opens settings and adds the application to their device’s trusted list.


val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)

Obfuscation

The Sumsub MobileSDK contains necessary proguard rules. You do not need to add it manually.

Reduce SDK size

TensorFlow (LiteRT)

You can reduce the size of your application's release build by removing TensorFlow library binaries, which will save about 7 MB, depending on the supported architectures.

Note that removing these libraries may affect some features of the Sumsub SDK:

  • Lower face detection accuracy in some cases.
  • The client-side photo quality detector will be disabled.
  • Automatic documents capture will be disabled.

To remove TensorFlow binary from the resulting APK (or AAB), add the following code to the application's build.gradle file:

android {
    // excludes heavy TF *.so files from the apk.
    packagingOptions {
        exclude 'lib/**/libtensorflowlite_jni.so'
    }
}

The Fisherman library is enabled by default starting from Android SDK version 1.43.0.

You can reduce the size of your application by excluding Fisherman library from main library's module. If you exclude the Fisherman library, the Device Intelligence feature will not be available.

To exclude Fisherman library from the resulting APK (or AAB), modify the library implementation inside build.gradle file:

dependencies {
    implementation("com.sumsub.sns:idensic-mobile-sdk:x.y.z") {
        // Excludes the Fisherman module while keeping the rest of the SDK unchanged
        exclude(group = "com.sumsub.sns", module = "idensic-mobile-sdk-fisherman")
    }
}



Did this page help you?