Demo
Install CV-Demo.apk to your phone and log in with the test account.
Integrate the plugin into your project
Open/your-project-name/android/build.gradleadd this maven repository:
xxxxxxxxxx...allprojects {repositories {...maven {url 'https://public-n3.advai.net/repository/maven-releases/'}}}
Open /your-project-name/android/app/build.gradleadd SDK dependencies:
xxxxxxxxxxdependencies {...api 'ai.advance.mobile-sdk.android:global-iqa-rn:1.2.8'}
Quick Start
Add GlobalIQAReactPackage
In the android/app directory, find the class that implements ReactApplication with the default name MainApplication, add GlobalIQAReactPackage
xxxxxxxxxximport ai.advance.global_iqa.sdk.rn.GlobalIQAReactPackage;public class MainApplication extends Application implements ReactApplication {private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {@Overrideprotected List<ReactPackage> getPackages() {return Arrays.<ReactPackage>asList(new MainReactPackage(), new GlobalIQAReactPackage());}...}...}
Initialization SDK
xxxxxxxxxxNativeModules.GlobalIQAModule.initSDK()
Check License
The license is obtained by your server calling our openAPI, you need to check license before starting the activity.
xxxxxxxxxxNativeModules.GlobalIQAModule.setLicenseAndCheck("your license",(code)=>{// License check pass},(errorCode)=>{// Error license})
User binding (strongly recommended).
You can use this method to pass your user unique identifier to us, we will establish a mapping relationship based on the identifier。It is helpful for us to check the log when encountering problems.
xxxxxxxxxxNativeModules.GlobalIQAModule.bindUser('your unique userId')
Start the detection page and obtain the check result.
Each time the detection is successful, a unique IDVID and a clear photo will be returned.
We provide two ways to get images and detection results, you can get them directly through the SDK or you can request the results via IDVID.
xxxxxxxxxx// After the detection is over, we will return the detection results immediatelyconst extras : object = { region: "ID", cardType: "ID_CARD",cardSide:"FRONT"}NativeModules.GlobalIQAModule.startGlobalIQA(extras,result=>{console.log(JSON.stringify(result));
})
With extras you can customize UI elements, here's an example
xxxxxxxxxxconst extras : object ={region:"ID",// required,Regional ISO codes, use either 2 or 3 digit short codescardType:"ID_CARD", // required,Card type, enumeration value:ID_CARD,DRIVING_LICENSE,UMID,SSS,TIN,PASSPORT,VOTERID,NATIONALID,PRC,PAGIBG,POSTALIDcardSide:"FRONT",// required,Card front and back, enumerated values:FRONT,BACKsoundPlayEnable:true,// Whether the sound broadcast is on, the default is onpageColor:"#ffffff",// Page main colorprimaryTextColor:"#000000",// Page main text colorframeRectColor:"#000000",// The color of the camera mask layertitleBackgroundColor:"#ffffff",// Color of the title barflipCameraBtnVisible:true,// Whether the flip camera button is visible,default is truelightBtnVisible:true,// Whether the flashlight button is visible, the default is visibletipIconVisible:true,// Whether the small icon of the bottom prompt control is visible during vertical scanningtitleTextColor:"#000000",// The text color of title barcameraWidthPercentInPortraitState:0.8,// The width percent of camera view when the page at portrait state,the value must between [0,1]cameraHeightPercentInLandscapeState:0.7,// The width percent of camera view when the page at landscape state,the value must between [0,0.7]retakeBtnTextColor:"#000000",// The retake button text color in 'Take Photo' modecontinueBtnTextColor:"#000000",// The continue button text color in 'Take Photo' modetakePhotoTipDialogShowSeconds:5,// The tip dialog(when scanning timeout) duration seconds, set to 0 will not show the dialogscanLimitSeconds:20,// The scanning seconds limit,the value must between [5,60]countdownTimerVisible:true,// Whether the countdown timer view shownscreenOrientation:"AUTO" // Lock screen orientation, default adaptive rotation direction, enumerated values: LANDSCAPE, PORTRAIT, AUTO}
A success result sample of [Global Document Verification]
xxxxxxxxxx{"success":true,"image":"\/9j\/4AAQSk...","idvid":"31262ac6-8b3a-4a30-96c1-3d4ca5b0d3ed","isPay":true,"transactionId":"58358c2e8894de35","ocrResult":"...","idForgeryResult":"...","pictureType":"scan"}
A success result sample of [Global Image Quality Check]
xxxxxxxxxx{"success":true,"image":"\/9j\/4AAQSk...","idvid":"31262ac6-8b3a-4a30-96c1-3d4ca5b0d3ed","isPay":true,"transactionId":"58358c2e8894de35","pictureType":"scan"}
Multilingual
SDK supports three languages, English, Indonesian and Chinese, switching automatically with the cellphone system language.
If the SDK does not automatically switch with the system language, please check your cellphone language settings and make sure that both [Region] and [Language] are switched to the corresponding language.
If it still have problems with multiple languages and the app only supports one language, you can filter out the unwanted languages by adding the following configuration to build.gradle
xxxxxxxxxxandroid {defaultConfig {...resConfigs("in-rID") // For example, only Indonesian is supported}}
Runtime Permissions
This SDK requires the following permissions, which have been configured in the aar manifest file and the SDK itself is ready for dynamic application of Android 6.0+ permissions.
xxxxxxxxxx<uses-feature android:name="android.hardware.camera" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.CAMERA" />
Code proguard configuration
The SDK already has code proguard, no additional configuration is required.
SDK Compatibility
armeabi-v7a,arm64-v8a,x86,x86_64,armeabi