Live demo of agent247 on Digio's docs — click the orange button at the bottom right to start.

Android eSign/eMandate SDK

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:

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_esign:v4.0.17'
    implementation 'com.github.digio-tech:cvl_esign:v1.0.2'                 //required dependency for signing with cvl esp partner
    implementation 'com.github.digio-tech:cvl_rdservice:v1.0.0'             //required dependency for using cvl based biometric signing
    implementation 'com.github.digio-tech:protean-esign:v3.12'               //required dependency for signing with nsdl esp partner
    implementation 'com.scottyab:rootbeer-lib:0.1.0'                        //required dependency for using nsdl


    // Other dependencies
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
    implementation 'com.android.volley:volley:1.2.1'

    // 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'

}

3. After updating dependencies click File => Sync Project with Gradle Files

Digio SDK supports android version 5.0 and above (SDK level 21 above)

Biometric Configuration

  1. FingerPrint/IRIS/FACE authentication required RD service App.
  2. RD services app must be installed in device (Provided by vendor)
  3. For face based authentication on SANDBOX environment use the following apk from the given link.
    Face RD service SANDBOX

On PRODUCTION - App will be redirected to play store to install necessary RD Service.

Note - For hybrid applications (eg. React-Native,Ionic,Cordova etc), you need to create a method-channel/bridge/plugin to communicate with the native SDK.

Steps to Invoke signing

1. Configure Digio instances : should be called on activity/fragment onCreate

Digio digio = new Digio();

@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.setSecondaryColorHex("#141414");
    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
    digioConfig.setServiceMode(DigioServiceMode.OTP);  // FP/OTP/IRIS/FACE
    try {
        digio.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 onDigioSuccess(@NonNull DigioResponse digioResponse) {
    System.out.println("digioResponse = " + digioResponse);
}

@Override
public void onDigioFailure(@NonNull DigioResponse digioResponse) {
    System.out.println("digioResponse = " + digioResponse);
}

@Override
public void onGatewayEvent(@NonNull GatewayEvent gatewayEvent) {
    System.out.println("gatewayEvent = " + gatewayEvent);
}

3. Starting the sign flow

try {
    digio.start(signForm.getDocumentId(), signForm.getEmail()); //this refers DigioResponseListener
} catch (Exception e) {
    e.printStackTrace();
}

4. Proguard :

-dontwarn org.json.**
-keep class org.json** { *; }

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. Check logcat for crash logs.

DigioConfig Params

ParamsDigioServiceModeDefault/Mandatory
DigioEnvironmentSANDBOX, PRODUCTIONDefault : PRODUCTION
DigioServiceModeOTP, FP, IRIS, FACEOTP : (Default) Aadhaar OTP authentication based eSign
FP : Fingerprint authentication based Aadhaar eSign (Biometric)
IRIS : Iris authentication based Aadhaar eSign
FACE : Face authentication based Aadhaar eSign
Logologo url max 100 charDigio logo will be used if not passed
ThemePrimary ColorPrimary color for eSign/eMandate journey

Start Params

ParamsTypeReason/Mandatory
DocumentIdMandatoryA document id starts with DID** or ENA**
IdentifierMandatoryIdentifier can be email or phone number.
TokenIdOptionalTokenId is used to avoid first factor authentication. (GWT**)

Sample Response

documentIdDID22040413040490937VNTC6LAP8KWDString format (Request ID Passed by parent app)
messageSigning SuccessSigning Failure
Failure = Digio sdk crash
Webpage could not be loaded = web page not loaded due to internet connection issue even after 3 retries.
code1001
(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
screendocument_preview
npciTxnIdString
stacktraceIn 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 :
  • Version 4.0.8 :
    • Added FACE authentication to eSign
    • Using protean eSign SDK for biometric and face based authentication
    • Removed firebase crashlytics
  • 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.8 => 5.0.0 :
  • 4.0.6 => 4.0.8
    • Remove firebase crashlytics dependencies and gradle plugin if not required by app.
    • Add following dependencies implementation 'com.github.digio-tech:protean-esign:v3.12'
    • Add following to pro-guard rules
 -dontwarn org.json.**
 -keep class org.json** { *; }
  • 4.0.3 => 4.0.6
    • implemented onGatewayEvent on DigioResponseListener
    • add following dependencies
    • add implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' to build.gradle

Was this page helpful?