DFOCRScan

1. DFOCRScan SDK Guide

1.1 Abstract

DFOCRScan SDK is used to scan and identify the text information on aadhaar card or pan card, and output extracted information.

1.2 Current Version

SDK current version is v1.1.2,the latest updated on Jan 26th, 2021

Support cpu structures: armeabi-v7a,arm64-v8a.

SDK dual architecture compilation increments is 2.46M, and armeabi-v7a compilation increments 1.87M, arm64-v8a compilation increments 2.05M

The minimum support system version Android4.4

2. DFOCRScan SDK Integration

2.1 Note

License file (DFLicense) is used to control the package name and valid time of the program (the time range can be obtained by directly viewing the content of the file). Please make sure that the package name of the program is the same as the package name bound to the license.

2.2 SDK Directory Structure

目录

2.3 Quick Integration

Before you use the SDK, you need to integrate it into your development environment first.

1,Import DFOCRScanDemo's DFOCRScan module to your project by File->New->importModule->Select the DFOCRScan in DFOCRScanDemo folder->Continuously click Next to complete the import.

2,Add following code to the dependencies{} section of build.gradle.

compile project(':DFOCRScan')

For example:

allprojects {
    repositories {
        google()
        jcenter()

        flatDir {
            dirs project(':DFOCRScan').file('libs')
        }

    }
}

 dependencies {
     compile project('DFOCRScan')
 }

3,Copy all files in the assets directory of the DFOCRScanDemo project to your project's assets directory.

2.4 Start Detection

Jump detection card activity

 DFOCRScan.create(this)
        .startCardDetect()
        .forResult(100);

Use onActivityResult to receive data

if (requestCode == 100){
    if (resultCode == RESULT_OK) {
            //detect card result
            DFCardInfo cardInfo = DFOCRScan.obtainCardResult(data);

            String cardType = cardInfo.getCardType();
            if (TextUtils.equals(cardType, DFCardInfo.CARD_TYPE_AADHAAR_CARD_FRONT)) {
                DFAadhaarCardFrontInfo  aadhaarCardFrontInfo = (DFAadhaarCardFrontInfo) cardInfo.getCardInfo();
            } else if (TextUtils.equals(cardType, DFCardInfo.CARD_TYPE_AADHAAR_CARD_BACK)) {
                DFAadhaarCardBackInfo  aadhaarCardBackInfo = (DFAadhaarCardBackInfo) cardInfo.getCardInfo();
            } else if (TextUtils.equals(cardType, DFCardInfo.CARD_TYPE_PAN_CARD)) {
                DFPanCardInfo  panCardInfo = (DFPanCardInfo) cardInfo.getCardInfo();
            }
    } else {
        if (data != null) {
              //error code
              int errorCode = DFOCRScan.obtainErrorCode(data);
        }
    }
}

card result refer to DFCardInfo

aadhaar front card result refer to DFAadhaarCardFrontInfo

aadhaar back card result refer to DFAadhaarCardBackInfo

pan card result refer to DFPanCardInfo

2.5 Code Confusion

Code confusion will result in crash because of no corresponding methods, therefore, you should add the following code in proguard file:

-dontwarn com.dfsdk.**
-keep class com.dfsdk.** { *; }

2.6 Get SDK Version

int sdkVersion = DFOCRClassifySDK.getSDKVersion()

results matching ""

    No results matching ""