Skip to content

Android (Kotlin)

Requirements: Min SDK 21 (Android 5.0), target SDK 34, Kotlin 1.8.10+, Gradle 8.0+.

Install — add the SDK Maven repo to your root build.gradle:

allprojects {
  repositories {
    google()
    mavenCentral()
    maven { url 'https://sdk.socure.com/' }
  }
}

Then add the dependency to your app build.gradle:

dependencies {
  implementation 'com.socure.devicerisk.sdk:socure-devicerisk:4.8.0'
}

If you use code obfuscation, add this ProGuard rule: -keep class com.socure.idplus.** { *; }.

Initialize:

import com.socure.idplus.devicerisk.androidsdk.SigmaDevice
import com.socure.idplus.devicerisk.androidsdk.model.SigmaDeviceOptions

val options = SigmaDeviceOptions().apply { omitLocationData = false }

SigmaDevice.initializeSDK(
    context = applicationContext,
    sdkKey = "YOUR_SDK_KEY",
    options = options,
    callback = object : SigmaDeviceCallback {
        override fun onComplete() { /* SDK ready */ }
        override fun onError(t: SigmaDeviceError, m: String?) { /* handle */ }
    }
)

Generate a token and run SNA — do both before your Prefill request:

SigmaDevice.getSessionToken(object : SessionTokenCallback {
    override fun onComplete(sessionToken: String) {
        val diSessionToken = sessionToken
        // performSilentNetworkAuth is the call that actually runs SNA.
        // Mobile number in E.164 format.
        SigmaDevice.performSilentNetworkAuth("+15551234567", object : SilentNetworkAuthCallback {
            override fun onSuccess() { /* proceed to Prefill with diSessionToken */ }
            override fun onError(e: SilentNetworkAuthError, m: String?) { /* proceed anyway — OTP fallback */ }
        })
    }
    override fun onError(t: SigmaDeviceError, m: String?) {
        // Proceed without token (OTP fallback)
    }
})

SNA also needs <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> in your manifest, plus an active SIM and cellular data.