Comment on page
Getting Started
Installation and Initialization
Note: The Android v10 SDK is currently in beta, and not all products and functionalities are supported. Please use Android SDK v7 for the full suite of current functionality.
⚠
- Android 5.0+ (API level 21+)
- A device with Google Play Services
Add the dependency to your module-level Gradle Build file
build.gradle.kts (Kotlin DSL)
build.gradle (Groovy)
implementation("com.smileidentity:android-sdk:<latest-version>")
implementation "com.smileidentity:android-sdk:<latest-version>"
Place the
smile_config.json
file under your application's assets, located at src/main/assets
(This should be at the same level as your java
and res
directories) Note: You may need to create this directory if it does not already exist
⚠
Initialize the Smile ID SDK in your
Application
class' onCreate
You may need to create an
Application
class for your app, if one doesn't already existKotlin
Java
ExampleApplication.kt
package com.example.app
import android.app.Application
import com.smileidentity.SmileID
class ExampleApplication : Application() {
override fun onCreate() {
super.onCreate()
SmileID.initialize(this)
}
}
ExampleApplication.java
package com.example.app;
import android.app.Application;
import com.smileidentity.SmileID;
public class ExampleApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
SmileID.initialize(this);
}
}
To set the callback URL used for jobs (to deliver results to your own server), use the setCallbackUrl method
SmileID.setCallbackUrl(URL("https://smileidentity.com"))
To switch between Sandbox and Production you should initialize using
SmileID.initialize(context = this, useSandbox = false)
or SmileID.initialize(context = this, useSandbox = true)
.All Products are implemented using Jetpack Compose and therefore exposed as Composable functions. This is the encouraged usage pattern.
If your application employs the traditional View-based approach, then we also expose
androidx.fragment.app.Fragment
based wrappers around the Composables. You should use getSupportFragmentManager().setFragmentResultListener(...)
to listen for results. Examples are provided for each product.The product screens will handle performing all network requests for you. However, it is also possible to make REST API calls directly via
SmileID.api
. Please refer to the Javadoc for further details.Use
SmileID.api.pollSmartSelfieJobStatus
, SmileID.api.pollDocVJobStatus
, or SmileID.api.pollBiometricKycJobStatus
to poll a given Job's status until it is complete.It is implemented using Kotlin Flows, which will emit a response for every poll attempt made.
You must handle and catch errors within your own Flow collection.
The delay and number of attempts is configurable.
Alternatively, you may use
SmileID.api.getSmartSelfieJobStatus
, SmileID.api.getDocVJobStatus
, or SmileID.api.getBiometricKycJobStatus
to perform a one-off job status check.Crash reporting is enabled by default. Only crashes caused by Smile Identity will be reported. This will not interfere with any other crash reporting you may be doing.
It can optionally be disabled by calling
SmileIDCrashReporting.disable()
at runtime or by passing false
at initialization (Not Recommended)All resource identifiers defined by the SDK are prefixed by
si_
so as to prevent naming clashes with your application resources. You may override any resource value -- for further information, see CustomizationLast modified 1mo ago