This SDK provides the following two services, please refer to the corresponding services according to your actual needs.
IDVID:Image id, the user will generate this IDVID after scanning the image automatically or taking the picture manually on the SDK, through the IDVID you can get the image information from us
Service Name | License Authorization | Scan | Take Photo | Get images from SDK | Generate IDVID | Get the image via IDVID | Get OCR and ID forgery results from SDK | Get OCR and ID forgery results via IDVID |
---|---|---|---|---|---|---|---|---|
Global Image Quality Check | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
Global Document Verification | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Install CV-Demo.apk on your phone and log in with the test account.
Click to download SDK (Beta version)
Copy iqc_plugin
to the root directory of the project or the existing plugins
folder in the project.
Open the pubspec.yaml
file in the root directory and add a reference to the iqc_plugin plugin under the dependencies node:
dependencies
...
iqc_plugin
path plugins/iqc_plugin
The demo project is located in the ios folder that the root directory. Open Runner.xcworkspace,execute the following two commands:
flutter pub get
pod install
Add camera and motion sensor (gyroscope) usage description in Info.plist
as bellow. Ignore this step if you have added those.
<key>NSCameraUsageDescription</key>
<string>Use the camera to detect the card</string>
CD to the root directory and copy the iqa_plugin folder to your iOS flutter project.
Open the pubspec.yaml
file in the root directory and add a reference to the liveness_plugin plugin under the dependencies node:
dependencies
iqc_plugin
path /path/to/iqc_plugin
Specify the SDK name and url in your iOS Podfile:
target 'Your project target name' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
pod 'AAINetwork', :http => 'https://prod-guardian-cv.oss-ap-southeast-5.aliyuncs.com/sdk/iOS-libraries/AAINetwork/AAINetwork-V1.0.2-PrivacyInfo.tar.bz2', type: :tbz
pod 'AAIGlobalIQA', :http => 'https://prod-guardian-cv.oss-ap-southeast-5.aliyuncs.com/sdk/iOS-global-IQA/1.2.8/iOS-GlobalIQA-SDK-V1.2.8.tar.bz2', type: :tbz
end
If you have any questions in this step, please refer to the demo project
Declare the plugin.
import 'package:iqc_plugin/iqc_plugin.dart';
Initialize the SDK.
GlobalIQCPlugin.initSDK();
Set license (call openAPI to obtain license by your server)
void _checkLicense() async {
String license = "";
String? result = await GlobalIQCPlugin.setLicenseAndCheck(license);
print(result);
if ("SUCCESS" == result) {// license is valid
startGlobalIQCDetection();
} else {
// license is invalid, expired/format error /appId is invalid
}
}
Get the SDK version number.
GlobalIQCPlugin.getSDKVersion.then((sdkVersion) {
print(sdkVersion);
});
Start detection and obtain the result.
Each time the detection is successful, a unique IDVID and a photo will be returned.
You can get the image directly through the methods provided by the SDK, or you can call the openAPI from the server.
x// Sample code
class _SomePageState extends State<SomePage> implements GlobalIQCCallback{
...
void startGlobalIQCDetection() {
GlobalIQCPlugin.startGlobalIQC(this,
{"region": "ID", "cardType": "ID_CARD", "cardSide": "FRONT"});
}
void onGetGlobalIQCResult(bool isSuccess, Map? resultMap) {
print(resultMap);
}
}
With extras you can customize UI elements
key | value type | Supported by Android? | Supported by iOS? |
---|---|---|---|
region | Stirng | true | true |
cardType | String | true | true |
cardSide | String | true | true |
mode | String | true | True |
soundPlayEnable | bool | true | true |
pageColor | String | true | true |
primaryTextColor | String | true | true |
frameRectColor | String | true | true |
frameRectCornerRadius | num | true | false |
titleBackgroundColor | String | true | true |
flipCameraBtnVisible | bool | true | true |
lightBtnVisible | bool | true | true |
tipIconVisible | bool | true | true |
titleTextColor | String | true | true |
cameraWidthPercentInPortraitState | float | true | true |
cameraHeightPercentInLandscapeState | float | true | false |
retakeBtnTextColor | String | true | false |
continueBtnTextColor | String | true | false |
takePhotoTipDialogShowSeconds | float | true | true |
scanLimitSeconds | float | true | true |
countdownTimerVisible | bool | true | true |
screenOrientation | String | true | true |
returnEmptyOfOCR | bool | true | true |
frameRectCornerRadius | float | true | false |
takePhotoTipViewBackgroundColor | String | true | false |
takePhotoTipViewLeftIconVisible | bool | true | false |
portraitTipConfig | Object | true | false |
landscapeTipConfig | Object | true | false |
This example is the keys explain and the value of option,
{
"region":"ID",// required,Regional ISO codes, use either 2 or 3 digit short codes
"cardType":"ID_CARD", // required,Card type, enumeration value:ID_CARD,DRIVING_LICENSE,UMID,SSS,TIN,PASSPORT,VOTERID,NATIONALID,PRC,PAGIBG,POSTALID
"cardSide":"FRONT",// required,Card front and back, enumerated values:FRONT,BACK
"soundPlayEnable":true,// Whether the sound broadcast is on, the default is on
"mode":"DEFAULT",// Mode is the startup mode, with three enumerations: SCAN, TAKE_PHOTO, DEFAULT.
"pageColor":"#ffffff",// Page main color
"primaryTextColor":"#000000",// Page main text color
"frameRectColor":"#000000",// The color of the camera mask layer
"frameRectCornerRadius":20,// The radius of the camera mask layer
"titleBackgroundColor":"#ffffff",// Color of the title bar
"flipCameraBtnVisible":true,// Whether the flip camera button is visible,default is true
"lightBtnVisible":true,// Whether the flashlight button is visible, the default is visible
"tipIconVisible":true,// Whether the small icon of the bottom prompt control is visible during vertical scanning
"titleTextColor":"#000000",// The text color of title bar
"cameraWidthPercentInPortraitState":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] (This feature only works on Android side)
"retakeBtnTextColor":"#000000",// The retake button text color in 'Take Photo' mode
"continueBtnTextColor":"#000000",// The continue button text color in 'Take Photo' mode
"takePhotoTipDialogShowSeconds":5,// The tip dialog(when scanning timeout) duration seconds, set to 0 will not show the dialog
"scanLimitSeconds":20,// The scanning seconds limit,the value must between [5,60]
"countdownTimerVisible":true,// Whether the countdown timer view shown
"screenOrientation":"AUTO", // Lock screen orientation, default adaptive rotation direction, enumerated values: LANDSCAPE, PORTRAIT, AUTO
"returnEmptyOfOCR":true, //Whether to return null value on fields that recognized as empty, defaults is NO.
"takePhotoTipViewBackgroundColor": "#000000",// The sound tip view background color
"takePhotoTipViewLeftIconVisible": true,// Whether to prompt the voice prompt control
"portraitTipConfig": {// The configuration of the vertical scanning prompt
"viewWidthPercentRelativeToCameraView": 1.0,// The width ratio of the prompt control relative to the camera control, e.g., setting it to 1 means it has the same width as the camera control
"aspectRatio": 0.3,// Aspect ratio of the control, width/height
},
"landscapeTipConfig": {// The configuration of the horizontal scanning prompt
"viewWidthPercentRelativeToCameraView": 1.0,
"aspectRatio": 0.3,
}
}
A success result sample of [Global Document Verification]:
{
"success":true,
"image":"\/9j\/4AAQSk...",
"IDVID":"31262ac6-8b3a-4a30-96c1-3d4ca5b0d3ed",
"isPay":true,
"transactionId":"58358c2e8894de35",
"ocrResult":{
"idNumber":"000000000000",
"fullName":"XXX",
"expiryDate":"XXX",
"state":"XXX",
"city":"XXX",
"district":"XXX",
"subdistrict":"XXX",
"fullAddress":"XXX",
"gender":"XXX",
"religion":"XXX",
"nationality":"XXX",
"others":{
"occupation":"XXX",
"maritalStatus":"XXX"
}
},
"idForgeryResult":{
"result":"pass",
"data":"valid"
},
"pictureType":"scan"
}
A success result sample of [Global Image Quality Check]
{
"success":true,
"image":"\/9j\/4AAQSk...",
"IDVID":"31262ac6-8b3a-4a30-96c1-3d4ca5b0d3ed",
"isPay":true,
"transactionId":"58358c2e8894de35",
"pictureType":"scan"
}
Read the latest results at anytime after the completion of the Liveness Detection(This feature is only supported on Android).
You can get the result in the callback after the Liveness Detection is completed (step 5), or you can get it at any time through the following methods.
GlobalIQCPlugin.getLatestDetectionResult.then((latestDetectionResult) {
print(latestDetectionResult);
});
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.
GlobalIQCPlugin.bindUser("your user id");
Code | Explanation | Solution |
---|---|---|
CHECKING_BAD_NETWORK | The image uploading network request failed after the motion ended | Try again after using VPN |
DEVICE_NOT_SUPPORT | The device does not support liveness detection | The device has no front camera or is unavailable |
USER_GIVE_UP | The user interrupted the Liveness detection | / |
UNDEFINED | Other undefined errors | / |
NO_RESPONSE | Request network failed | Check your network status. |
AUTH_PARAMETER_ERROR | Authorization request parameter error | Please check whether the key passed to the initialization method is SDK’s or not, and make sure that the Market matches. |
AUTH_IAM_FAILED | Package name not registered | Self-configuration on SaaS (Personal Management -> ApplicationId Management) or contact us to add |
Code | Explanation | Solution |
---|---|---|
USER_GIVE_UP | The user tapped the back button | / |
DEVICE_NOT_SUPPORT | This device is not supported | The device has no front camera or is unavailable |
NETWORK_REQUEST_FAILED | Network request failed | Check your network status. |
CAMERA_OPEN_FAILED | Failed to open the camera | / |
MODEL_ERROR | Load model failed | / |
Other error code... | See document | / |