Android
Sample Project
You can find the sample project for sample code for Android Integration.
Requirements:
The minSdkVersion must be 19 or higher and targetSdkVersion should be 31 or higher for the application.
Latest Stable Version
The current latest release of IDWise SDK.
Android SDK |
---|
IDWise 4.3.4 |
Step 1: Add IDWise SDK dependency
In order to use IDWise SDK you need to add the following sections to thebuild.gradle
file
- Add
multiDexEnabled true
anddataBinding true
in these sections:
android {
...
defaultConfig {
...
multiDexEnabled true
}
buildFeatures {
...
dataBinding true
}
}
- Add the following repositories:
repositories {
maven { url 'https://mobile-sdk.idwise.ai/releases/' }
maven { url 'https://jitpack.io' }
}
- Add the following dependency inside your
dependencies
section:
implementation 'com.idwise:android-sdk:VERSION_NUMBER'
For example, to use vx.y.z of our SDK, you would do the following:
dependencies {
...
implementation 'com.idwise:android-sdk:x.y.z'
}
If you use Proguard
You need to update your build as follow:
// generate release apk buildTypes { release { signingConfig signingConfigs.release proguardFile '../proguard.pro' minifyEnabled true //enableR8 code Shrinking & Obfuscation shrinkResources true } }
And add the following file to your app proguard.pro, in case the first simpler configuration doesn’t work, please try the second more comprehensive configuration in proguard-2.pro
Step 2: Initialize IDWise SDK
The first step to use IDWise SDK is to initialize it in your Activity or Fragment as follows:
IDWise.initialize(clientKey, IDWiseSDKTheme.SYSTEM_DEFAULT) {
error: IDWiseSDKError? -> error?.printStackTrace()
}
initialize
method takes two parameters:
clientKey
: is a key provided to you by IDWise to authenticate your app with IDWise backend.theme
: is an enum to indicate the theme (Light or Dark) to use for IDWise's UI. it accepts the following values:IDWiseSDKTheme.SYSTEM_DEFAULT
: follows the system theme.IDWiseSDKTheme.LIGHT
: to force the theme to be in light mode.IDWiseSDKTheme.DARK
: to force the theme to be in dark mode.
Step 3: Start a new journey
Once the SDK is initialized, it becomes ready to start an ID verification journey flow. To commence the flow, the SDK offers a startJourney
method, as demonstrated below.
IDWise.startJourney(
context,
"<FLOW_ID>", //Provided by IDWise
"<REFERENCE_NUMBER>",
"en",
object : IDWiseSDKCallback {
override fun onJourneyStarted(journeyInfo: JourneyInfo) {
Log.d("IDWiseSDKCallback", "onJourneyStarted")
}
override fun onJourneyResumed(journeyInfo: JourneyInfo) {
Log.d("IDWiseSDKCallback", "onJourneyResumed")
}
override fun onJourneyCompleted(journeyInfo: JourneyInfo, isSucceeded: Boolean
) {
Log.d("IDWiseSDKCallback", "onJourneyCompleted")
}
override fun onJourneyCancelled(journeyInfo: JourneyInfo?) {
Log.d("IDWiseSDKCallback", "onJourneyCancelled")
}
override fun onError(error: IDWiseSDKError) {
Log.d("IDWiseSDKCallback", "onError ${error.message}")
}
})
This method takes the following parameters:
-
flowId
: (also called Journey Definition ID): This is a unique identifier that identifies your journey flow. IDWise shares this with you when you register to use IDWise system. -
referenceNo
: (Optional) This parameter allows you to attach a unique identifier (such as a reference number) with the user undergoing the current journey. It's beneficial for connecting the journey to the user and/or the application that initiated it. You will receive this reference number in the webhook request. -
locale
: (Optional)This refers to the ISO code representing the desired language for the user interface components. Please reach out to IDWise Support for the list of available languages. -
IDWiseSDKCallback
: This is an implementation of an interface that consists of various callback events. These events are:-
onJourneyStarted
: This event is triggered when a user's journey begins. It serves to notify your application that the process has been initiated. Useful for logging or implementing any preparatory actions necessary for the journey. -
onJourneyCompleted
: This callback is activated upon the completion of a user's journey. It signifies that the user has successfully navigated through all steps and finished the process. This is typically where you would implement any code required to handle the completion of the journey. -
onJourneyCancelled
: This event is fired if the user decides to cancel the journey midway. It indicates the user's choice to discontinue the process. This could be useful for providing user-specific feedback or triggering re-engagement strategies. -
onError
: This event is invoked when an error occurs at any point during the journey. It allows your application to respond to any unexpected issues, ensuring smooth error handling and user experience. Bellow all possible errors.
-
Customizing UI for ID Verification Journey
The text prompts, images, and colors for both light and dark modes within an ID verification journey are fully customizable. This customization process is carried out in our cloud, offering the following advantages:
- No App Update Required: You are not required to publish a new version of your app to the store every time you customize the journey.
- Seamless User Experience: Your users won't need to take any action to apply the customizations you make; they will seamlessly pick up the changes.
For assistance with this customization, please feel free to reach out to our IDWise Support team!
Common Error Codes and Their Causes
IDWiseErrorCode | Int Value | Cause |
---|---|---|
INVALID_PARAMETERS | 11 | clientKey is invalid or empty. |
SDK_NOT_INITIALIZED | 22 | Either You haven’t Called the IDWise.initialize or you haven’t waited for a callback |
WRONG_CREDENTIALS | 33 | clientKey is incorrect |
INTERNAL_ERROR | 44 | Internal Error occurred while processing the request |
Updated 13 days ago