Refer to latest sdk implementation v5.0.0 using the Android Gateway v5.0.0 documentation above__
How to Integrate?
1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
plugins {
id 'com.android.application' version '8.7.1' apply false
id 'com.android.library' version '8.7.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
id 'androidx.navigation.safeargs' version '2.8.3' apply false
id 'com.google.gms.google-services' version '4.3.10' apply false
}
2. Add the dependency and view/data Binding build config:
plugins {
id 'com.android.application'
}
android {
...
compileSdk 35
defaultConfig {
...
minSdkVersion 24
targetSdk 35
...
}
buildFeatures {
viewBinding true
dataBinding true
}
}
dependencies {
implementation 'com.github.digio-tech:gateway:v4.0.22'
implementation 'com.github.digio-tech:gateway_kyc:v4.0.24'
// Other dependencies
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
// Added in version 4.0.6
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
//Following dependency is also not required if org.jetbrains.kotlin.android plugin version is 1.8.*
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.preference:preference:1.2.0'
implementation "androidx.camera:camera-camera2:1.2.2"
implementation "androidx.camera:camera-lifecycle:1.2.2"
implementation "androidx.camera:camera-view:1.2.2"
implementation "androidx.navigation:navigation-fragment-ktx:2.5.3"
implementation "androidx.navigation:navigation-ui-ktx:2.5.3"
// Use this dependency to use dynamically downloaded model in Google Play Service
implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
3. Permissions : Add required permissions in manifest file and run time. Note - This is the common SDK for various KYC flows
<!--RECORD_AUDIO and MODIFY_AUDIO_SETTINGS Permission required for Video KYC -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
/** Required for geo tagging */
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
/** Required for ID card analysis, selfie and face match**/
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
A fintech android app can't access following permission
- Read_external_storage
- Read_media_images
- Read_contacts
- Access_fine_location
- Read_phone_numbers
- Read_media_videos
Note: All required permission should be define in manifest file as well as take runtime permission, digio kyc sdk also handles the runtime permission starting from sdk version 4.0.1 please go through how to request permission Permissions on Android , optionally required permissions should be asked before starting the workflow.
4. After updating dependencies click File => Sync Project with Gradle Files
Digio SDK supports android version 5.0 and above (SDK level 21 above)
Note - For hybrid applications, you need to create a channel/bridge/plugin to communicate with the native SDK.
Steps to Invoke Kyc workflow
1. Configure Digio instances : should be called on activity/fragment onCreate
DigioWorkflowSession digioWorkflowSession = new DigioWorkflowSession();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DigioConfig digioConfig = new DigioConfig();
DigioTheme theme = new DigioTheme();
theme.setPrimaryColor(android.R.color.holo_red_dark);
theme.setFontFamily("Unbounded");
theme.setFontUrl("https://fonts.googleapis.com/css2?family=Unbounded:wght@200&display=swap");
digioConfig.setTheme(theme);
digioConfig.setLogo("https://www.digio.in/images/digio_blue.png"); // Your company logo url
digioConfig.setEnvironment(DigioEnvironment.SANDBOX); // SANDBOX or PRODUCTION
try {
digioWorkflowSession.init(this, digioConfig);
} catch (Exception e) {
e.printStackTrace();
}
}
2. DigioResponseListener and import onDigioSuccess, onDigioFailure override function in your activity/fragment. Below are function signatures
@Override
public void onWorkflowSuccess(@NonNull WorkflowResponse workflowResponse) {
Log.d("Response", "onDigioKycSuccess--> documentId " + workflowResponse.getDocumentId() + " message " + workflowResponse.getMessage());
}
@Override
public void onWorkflowFailure(@NonNull WorkflowResponse workflowResponse) {
Log.d("Response", "onDigioKycFailure--> documentId " + workflowResponse.getDocumentId() + " message " + workflowResponse.getMessage());
if (workflowResponse.getErrorCode() != null && workflowResponse.getErrorCode() == DigioErrorCode.DIGIO_PERMISSIONS_REQUIRED.getErrorCode()) {
String[] requiredPermissions = workflowResponse.getPermissions();
if (requiredPermissions != null && requiredPermissions.length > 0) {
this.requiredPermissions = requiredPermissions;
// Digio provides list of permission which is required to complete the workflow.
// take necessary action whether close the process or ask permission and restart workflow session.
// explain user why permission is required and how to enable permission.
}
}
}
@Override
public void onGatewayEvent(@NonNull GatewayEvent gatewayEvent) {
System.out.println("gatewayEvent = " + gatewayEvent);
}
3. Starting the kyc flow
try {
// First args : Document Id starting with KID
// Second args : Identifier (Email/Mobile)
// Third args (optional) : GWT token to skip the first factor authentication
digioWorkflowSession.start("KID***", "**Email/Mobile**", "GWT***");
} catch (Exception e) {
e.printStackTrace();
}
4. Proguard : No action is required for latest stable android studio, proguard-rules are already added to the sdk. It is required to test the release build for possible proguard exceptions before prod releases.
App crash after starting digio flow :
- Make sure init is called before start and all the parameter values are proper as the documentation.
- There is no missing dependency as described above.
DigioConfig Params
| Params | DigioServiceMode | Default/Mandatory |
|---|---|---|
| DigioEnvironment | SANDBOX, PRODUCTION | Default : PRODUCTION |
| Logo | logo url max 100 char | Digio logo will be used if not passed |
| Theme | Primary Color | Primary color for KYC journey |
Start Params
| Params | Type | Reason/Mandatory |
|---|---|---|
| DocumentId | Mandatory | A document id starts with KID** or RID** |
| Identifier | Mandatory | Identifier can be email or phone number. |
| TokenId | Optional | TokenId is used to avoid first factor authentication. (GWT**) |
Sample Response
| documentId | KID22040413040490937VNTC6LAP8KWD | String format (Request ID Passed by parent app) |
| message | Success | KYC Failed Failure = Digio sdk crash Webpage could not be loaded = web page not loaded due to internet connection issue even after 3 retries. |
| code/errorCode | 1001 (App should only depend upon the code not on message to check failure or success) | DigioConstants.RESPONSE_CODE_SUCCESS = 1001 RESPONSE_CODE_CANCEL = -1000 RESPONSE_CODE_FAIL = 1002 RESPONSE_CODE_WEB_VIEW_CRASH = 1003 RESPONSE_CODE_SDK_CRASH = 1004 DIGIO_PERMISSIONS_REQUIRED = 1008 |
| screen | starting_digio | |
| permissions | ['android.permission.CAMERA'] | List of mandatory permissions which are not given during kyc journey |
| stacktrace | In case of digio sdk crashes, the crash log |
Gateway Events :
Refer Gateway Event document for all possible events and error data : Gateway Event Doc
- DigioEvent
- documentId: string;
- txnId: string;
- entity: string;
- identifier: string;
- event: string;
- payload:
- type: 'error' | 'info';
- error?:
- code: string;
- message: string;
- data?: HashMap<String,Any>;
Change Logs
- Version 5.0.0 :
- Please check Android Gateway v5.0.0 documents
- Version 4.0.9 :
- Removed firebase crashlytics
- For reverse penny drop added upi apps intent flow.
- Version 4.0.6 :
- Introduced webview connection error handling with in digio sdk.
- Added internet connection observability, if internet connection get disconnected message will be displayed with in digio sdk.
- Digio activity will run in portrait mode only and will not re-create on any system configuration changes
- Digio Activity will not run in separate process, there is no requirement of any handling in Application class.
- Introduced Gateway events
Migration Guide
- 4.0.9 => 5.0.0
- Please check Android Gateway v5.0.0 documents
- 4.0.6 => 4.0.9
- Remove firebase crashlytics dependencies and gradle plugin if not required by app or other sdk's.
- 4.0.3 => 4.0.6
- implemented onGatewayEvent on DigioWorkflowResponseListener
- add following dependencies
- add
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'to build.gradle