Silent Liveness Lite
1.Product Description
The purpose of liveness detection is to detect whether a face is “alive” or just a fraudulent reproduction.
To ensure a faster and more convenient protection against spoofing, silent liveness detection is used. Silent liveness detection is non-intrusive. In other words, there is usually no way for the user to know they are being tested. The system does everything on its own – users don’t have to pay any attention at all.
2.Quick Integration Guide
2.1 Quick Integration
Before you use the SDK, you need to integrate it into your development environment first.
Import DFLivenessSilentDemo's DFLivenessLibrary module to your project by File->New->importModule->Select the DFLivenessLibrary in DFLivenessSilentDemo folder->Continuously click Next to complete the import.
Add following code in the dependencies{} section of build.gradle.
compile project(':DFLivenessLibrary')
For example:
allprojects { repositories { google() jcenter() } } dependencies { compile project('DFLivenessLibrary') }
2.2 Start Detection
Launch acitivity
Intent intent = new Intent(activity, DFAcitivityBase.class);
activity.startActivityForResult(intent, 100);
Use onActivityResult to receive data
Get SDK result by onActivityResult function.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == 100) {
int jpegW = data.getExtras().getInt(DFAcitivityBase.KEY_JPEG_WIDTH); // jpeg width
int jpegH = data.getExtras().getInt(DFAcitivityBase.KEY_JPEG_HEIGHT); // jpeg height
byte[] jpegBuffer = data.getExtras().getByteArray(DFAcitivityBase.KEY_JPEG_BUFFER); // jpeg data
}
}
Enable anti-hack in sample
If you want to enable anti-hack, you can set API_ID API_SECRET and HOST_URL in build.gradle. HOST_URL MUST be the 'Request URL' value in Server API Doc
buildTypes {
debug {
buildConfigField "String", "API_ID", "" // you can get this from us
buildConfigField "String", "API_SECRET", "" // you can get this from us
buildConfigField "String", "HOST_URL", ""
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "API_ID", "" // you can get this from us
buildConfigField "String", "API_SECRET", "" // you can get this from us
buildConfigField "String", "HOST_URL", ""
}
}