Only supports Android and iOS
Integrated Requirement
Compliance Explanation
Please note that when integrating SDK products provided by TrustDecision in your company's APP:
1.1 According to user information protection regulations, before users start the App for the first time and begin collecting information, your company should:
- Fully inform the user of the purpose, method, and scope of collecting, using, and sharing personal information with a third party
- Use an interactive interface or design (such as a privacy policy pop-up window)
- Obtain the express consent of the end user
1.2 To provide business security and risk control services, the TrustDecision SDK will collect, process, and use the following device information:
- Identification information (IMEI/IDFA)
- AndroidID
- IMSI
- MEID
- MAC address
- SIM card serial number
- Device type and model
- System type
- Geographical location
- Login IP address
- Application list
- Running processes
- Sensor information (light, gravity, magnetic field, acceleration, gyroscope)
Privacy Policy: TrustDecision Privacy Policy
Environment
Items | Description |
---|---|
Supported System Versions | iOS 9.0+ |
Supporting Architecture | armv7, arm64, x86_64 |
Integration Steps
There are 3 steps to integrate Liveness Detection SDK:
- Use the Retrieve License API to get a license within the effective timeframe
- Integrate the SDK for both Android and iOS platforms, initializing liveness detection with the generated license and obtaining the
livenessId
- Use the Retrieve Result API with the generated
livenessId
to:- Obtain a selfie if liveness detection is successful
- Receive detailed results in case of failure
1) Retrieve License API
Please follow the steps in Liveness API License Retrieval
2. SDK Integration Methods
CocoaPods Installation
- Add
pod 'TrustDecisionPro', '4.4.2.2'
in the corresponding target in the Podfile - For full version, add
pod 'TrustDecisionLiveness', '2.4.1'
- For lite version, add
pod 'TrustDecisionLiveness-Lite', '2.4.0'
- Execute
pod install --repo-update
in the Podfile directory- M1 series Mac computers: Use
arch -x86_64 pod install --repo-update
- M1 series Mac computers: Use
SDK Structure
Pods/TrustDecisionPro directory:
- TDMobRisk.framework (TrustDecision SDK, static library)
- TDCorePlugin.framework (TrustDecision plugin, embedded dynamic library)
Pods/TrustDecisionLiveness directory:
- libTDLiveness.a (Mob-Risk SDK liveness component library, static library)
- CWResource.bundle (Mob-Risk SDK liveness component resource package)
3. Retrieve Result API
Please follow the steps in Liveness API Result Retrieval
Other
Get SDK Version
Future getSDKVersion()
Keep Configuration
-keep class com.trustdecision.**{*;}
All Configuration
Key | Description | 平台 | Sample |
---|---|---|---|
partner(required) | Partner code, contact operator to obtain. | All | options["partner"] = "your partner" |
appKey(required) | Application identification, please refer tohow to get appKey | All | options["appKey"] = "your appKey" |
country(required) | Data-center: cn for China fra for Europe sg for Singapore inda for Indonesia us for the USA | All | options["country"] = "your country" |
appName | Application name, contact operator to obtain | All | options["appName"] = "your appName" |
debug | Allow debugging, default false, must be closed before the application release. | All | options["debug"] = true |
timeLimit | Network timeout configuration, in seconds, default 15s | All | options["timeLimit"] = 5 |
location | whether collecting GPS location information, default allowed | All | options["location"] = true |
collectLevel | You can set M to control the maximum length of blackBox to 2000, default around 5000 | All | options["collectLevel"] = "M" |
IDFA | Whether collecting IDFA information, default allowed | iOS | options["IDFA"] = true |
deviceName | Whether collecting device name, default allowed | iOS | options["deviceName"] = true |
runningTasks | Whether collecting running tasks, default allowed | Android | options["runningTasks"] = true |
sensor | Whether collecting sensor information, default allowed | Android | options["sensor"] = true |
readPhone | Whether collecting READ PHONE STATE permission-related information, default allowed | Android | options["readPhone"] = true |
installPackageList | Whether collecting application list information, default allowed | Android | options["installPackageList"] = true |
Liveness Module
Install the Liveness Module dependency
iOS
1.Double-click to open the Runner.xcworkspace project;
2.Find the trustdevice_pro_plugin.podspec file;
3.Add the liveness module dependency in the trustdevice_pro_plugin.podspec file
s.dependency 'TrustDecisionLiveness'
4.In the folder where Runner.xcworkspace is located, execute
pod install --repo-update
Android
1.Open the android/build.gradle file
2.Add live library dependency in android/build.gradle file
dependencies {
implementation 'com.trustdecision.android:liveness:+'
}
Initial configuration optional parameter list
Key
Definition
Description
Scene
Sample code
language
language type
Liveness detection prompt language
Default: en English Options: en English zh-Hans Simplified Chinese zh-Hant Traditional Chinese es Spanish id Indonesian ar Arabic fil Filipino ko Korean pt Portuguese ru Russian th Thai tr Turkish vi Vietnamese
options["language"] = "en"
playAudio
Whether to play audio
The default is NO, no audio will be played
When turned on, the corresponding prompt audio will be played
options["playAudio"] = false
livenessDetectionThreshold
Difficulty threshold for live detection
Difficulty threshold for live detection, divided into three levels: high, medium, and low
The default is medium
Adjust to corresponding difficulty as needed
options["livenessDetectionThreshold"] = "medium"
livenessHttpTimeOut
SDK network timeout configuration (unit: seconds)
Default is 15s
Customers can set the network timeout according to their needs
options["livenessHttpTimeOut"] = 8
showReadyPage
When starting the face, the detection preparation page will pop up
Whether to display the preparation page, the default is YES, which means it will be displayed
After closing, the preparation page will not be displayed, and the identification process will be shorter
options["showReadyPage"] = true
faceMissingInterval
Timeout when no face is detected (unit: milliseconds)
No face timeout, unit ms, default is 1000ms
Set the timeout period when no face is detected as needed
options["faceMissingInterval"] = 1000
prepareStageTimeout
The starting time when preparing to detect the action (unit: seconds)
Preparation phase timeout, in seconds, the default is 0S, that is, it will never time out
Set the preparation phase timeout as needed
options["prepareStageTimeout"] = 0
actionStageTimeout
In the action phase, the maximum verification time (unit: seconds)
Action phase timeout, unit second, default is 8S
Set the action phase timeout as needed
options["actionStageTimeout"] = 8
Popup Liveness Window
Example Code
String license = "please use your license!!!";
await _trustdeviceProPlugin.showLiveness(license,TDLivenessCallback(onSuccess: (String seqId,int errorCode,String errorMsg,double score,String bestImageString,String livenessId) {
print("Liveness success!seqId: $seqId,livenessId:$livenessId,bestImageString:$bestImageString");
}, onFailed: (String seqId,int errorCode,String errorMsg,String livenessId) {
print("Liveness failed!, errorCode: $errorCode errorMsg: $errorMsg");
}));
Error Code
Code | Message |
---|---|
200 | success (live person) |
20700 | No face detected |
20702 | Person change detected |
20703 | Detection timeout |
20705 | Screen lock or background exit during detection |
20710 | No camera permission |
20711 | User actively cancels detection on the preparation page |
20712 | User actively cancels detection on the detection page |
20731 | Face not centered |
20732 | Face not facing the screen |
20749 | Inconsistent action, tilt head down |
60001 | Network issue, failed to retrieve session |
60002 | Network issue, failed to call anti-hack |
11350 | Internal error |
3. Retrieve Result API
Please follow the steps in Liveness API Result Retrieval
Import Header File
Please import the header file if you want to call SDK API.
Objective C
#import
Swift
import TDMobRisk
Initialization
Precautions
When the installation starts for the first time, the SDK initialization is performed after the user agrees with the privacy agreement.
Avoid SDK initialization collection without the user agreeing to the privacy agreement, causing compliance risk accidents.
Interface Definition
void (*initWithOptions)(NSDictionary *options);
initWithOptions Method Required Configuration
Key | Definition | Description | Scene | Sample Code |
---|---|---|---|---|
partner | Partner Code | Partner, please contact TrustDecision to obtain | All Scenes | Objective C |
[options setValue:@"[Your partner]" forKey:@"partner"]; |
Swift
options.updateValue("[Your partner]" as NSObject, forKey: "partner")
|
| appKey | App Key | Appkey, please offer your App bundleId for TrustDecision to obtain | All Scenes | Objective C
[options setValue:@"[Your appKey]" forKey:@"appKey"];
Swift
options.updateValue("[Your appKey]" as NSObject, forKey: "appKey")
|
| country | Country Code | Country/region parameters | Fill parameters according to business region | Objective C
[options setValue:@"[Your country code]" forKey:@"country"];
Swift
options.updateValue("[Your country code]", forKey: "country")
|