Link Search Menu Expand Document

Capture SDK (Android)

Users often do not provide the right document images at the time of onboarding. The low first time right rate leads to leakage of the sales funnel, and additional customer acquisition costs. Our “Right First Time” SDK solves this problem and ensures that the documents are captured properly. It is an android SDK with the following capabilities -

Table of contents

  1. Capabilities
    1. Capture Document
    2. Capture Selfie
    3. Upload Images
  2. Integrating the SDK
    1. Adding the SDK to your project
    2. Prerequisites
    3. Initializing the SDK
    4. Capturing Documents
    5. Capturing Selfies
    6. Uploading Images and working with EVE APIs
    7. Type of documents
    8. Error Codes
    9. Important Notes

Capabilities

Capture Document

You can use the SDK to capture documents, and ensure that the document images are captured right first time. This also ensures that you get the best results while performing OCR on the documents. Key features include -

  • Templates to ensure right capture of the document
  • Readability checks - blur detection, lighting detection
  • Incorrect document detection Beta (example - user selects PAN but uploads Aadhaar)
  • Compression of the image to right size

In case the document is not captured properly, the review screen shows an error and the user is asked to re-capture the image.

capture_document_1

capture_document_2

capture_document_3

Capture Selfie

You can use the SDK to capture selfie/face image, and ensure that the image is captured right first time. This also ensures that you get the best results while doing face match & face liveness. Key features include -

  • Blur detection
  • Face orientation detection
  • Multiple faces detection
  • Closed eyes detection
  • Compression of the image to right size

capture_image_1

In case the face image is not captured properly, the review screen shows an error and the user is asked to re-capture the image.

Upload Images

You can use this to upload images directly to idfy servers. We support encryption mechanism on this SDK (configurable) which keeps the images secure in-transit. When you upload the images, you will get an image link back. This image link can then be used to make API calls from the server.

Integrating the SDK

Adding the SDK to your project

To download the SDK, add the following to your project’s ‘build.gradle’ file:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io"}
        maven { url "https://mymavenrepo.com/repo/jeYsRLYFzkhy617P4O1I/" }
    }
}

And then add the following line in your app module to add the dependency:

implementation ‘com.idfy:rft:1.0.3’

Prerequisites

Firebase: You will need to set up your app with Firebase and add in a google-services.json generated during the Firebase sign-up process.

Camera permissions: You should ask your user for camera permissions when appropriate within your app. The SDK requires this permission to work.

Initializing the SDK

RFTSdk.init(context, accountId, token, rftConfiguration)

This function will initiate the SDK and provide an instance of RFTSdk. This instance will be further used to call other functions of the SDK.

Parameter Type Description
context Activity Current activity context
accountId string Identification token that will be shared by the IDfy team
token string Authentication token that will be shared by the IDfy team
rftConfiguration rftConfiguration Review screen visibility and UI elements can be optionally configured here. More details in the subsequent table
initCallback rftSdkInitCallback RftSdkInitCallback has 2 callback functions:
1. onInitSuccess allows you to access the capture and upload functions of the SDK
2. OnInitFailure returns an error which would be due to invalid token or account ID

RftConfigurations

paramter Type Default Values Example/Possible Values
ReviewScreen enum enable_all ReviewScreen.ENABLE_ALL
ReviewScreen.ENABLE_INCORRECT
ReviewScreen.DISABLE
Logo Bitmap null BitmapFactory.decodeResource(getResources(), R.drawable.logo)
Logo Alignment enum LogoAlignment.CENTER LogoAlignment.LEFT
LogoAlignment.CENTER
LogoAlignment.RIGHT
Primary Button Text Color int #ffffff Color.parseColor(“#ffffff”)
Primary Button Background Color int #207d94 Color.parseColor(“#207d94”)
Secondary Button Text Color int #207d94 Color.parseColor(“#207d94”)
Secondary Button Background Color int #ffffff Color.parseColor(“#ffffff”)

Capturing Documents

RFTSdkInstance.CaptureDoc(context, docType, callback)

Parameter Type Description
context Activity Current activity context
doc_type enum Document type (eg. ind_aadhaar_front) that is to be captured
use the exact value from the type of documents table below
callback RftImageCaptureCallback Instance of class/activity that implements RftImageCaptureCallback which contains 3 callback functions.
1. onCorrectCapture that returns bitmap image once image is captured and validated
2. onIncorrectCapture that returns bitmap image and reason for incorrect capture
3. onCaptureError that returns a RftException that contains the stacktrace of the error and the error

Incorrect Capture Insights:

  • The image is of some other document
  • No document detected in the image
  • The image is not readable
  • No face detected in the image
  • Multiple prominent faces detected in the image
  • Face is too far from the camera
  • Eyes are closed in the image

Capturing Selfies

RFTSdkInstance.CaptureFace(context, callback)

Parameter Type Description
context Activity Current activity context
callback RftImageCaptureCallback Instance of class/activity that implements RftImageCaptureCallback which contains 3 callback functions.
1. onCorrectCapture that returns bitmap image once image is captured and validated
2. onIncorrectCapture that returns bitmap image and reason for incorrect capture
3. onCaptureError that returns a RftException that contains the stacktrace of the error and the error

Uploading Images and working with EVE APIs

RFTSdkInstance.UploadImage(accountId, token, groupId, docType, image)

This function will return a self-link (image reference) of the uploaded image that will be used for task creation.

Parameter Type Description
accountId string account_id that will be fetched at the time of login using the token end-point*
token string Authentication token that will be fetched at the time of login using the token end-point*
groupId string Unique identifier to group checks for an individual profile
docType string please refer towards the end of document for supported document types
image bitmap This will be the image object that you will get it from RftSdkCallbackInterface
callback RftUploadCallback Callback for the success or failure of this function. The response contains a link that is a reference of the stored image. Eg: https://storage.googleapis.com/rftsdk/123

The reference URL can be used to initiate EVE’s Database Checks, Document Validation & Masking and Face APIs

Type of documents

docType Description
ind_aadhar Images or Scanned copy of an Aadhaar Card
ind_pan Images or Scanned copy of an Indian Tax Card
ind_voter Images or Scanned copy of Indian Voter Card
ind_driving_lisence Images or Scanned copy of Indian Driving Lisence
ind_passport Images or scanned copy of Indian Passport
face_image Image of live face
others Any other kind of document supported

Optionally, to explicitly define front and back of Doc Image, append “_front” or “_back” to the doc_type.

**Use the correct docType for the document being captured to ensure correct processing.
Quick check: The camera and review screens will have the document name if correct parameters are passed to the CaptureDocImage function

Error Codes

  • 403 - The token has expired. A new token needs to be fetched*

Important Notes

  • The CaptureDocImage and CaptureFaceImage functions will give a Bitmap image in callback interface.
  • UploadImage function involves a network call, so it’s recommended to use them in an asynchronous manner.
  • IDfy’s Right First Time(RFT) SDK aids the ,Verification, OCR and Face APIs by ensuring the image captured is correct and match the requisite quality standards. Here’s a link to the same: eve-api-docs.idfy.com
  • To get your api key, account id and token, drop an email to eve.support@idfy.com
  • Find the Github project of a test app with the SDK integrated, here! .