接入示例

最近更新时间:2023-06-07 14:14:56

我的收藏
权威库网纹图片比对、自带对比源对比接入示例:
# 在 MainActivity 中单击某个按钮的代码逻辑:
//先填好数据
Bundle data = new Bundle();
WbCloudFaceVerifySdk.InputData inputData = new WbCloudFaceVerifySdk.InputData(
faceId,
agreementNo,
openApiAppId,
openApiAppVersion,
openApiNonce,
userId,
userSign,
verifyMode,
keyLicence);
data.putSerializable(WbCloudFaceContant.INPUT_DATA, inputData);

//个性化参数设置,可以不设置,不设置则为默认选项。
//默认设置为简体中文,此处设置为英文
data.putString(WbCloudFaceContant.LANGUAGE,WbCloudFaceContant.LANGUAGE_EN);
//sdk样式设置,默认为白色
//此处设置为白色
data.putString(WbCloudFaceContant.COLOR_MODE, WbCloudFaceContant.WHITE);
//定制合作方个性化提示语,默认不设置
//此处将设置人脸采集时的个性化提示语data.putString(WbCloudFaceContant.CUSTOMER_TIPS_LIVE, “扫描人脸后与您身份证进行对比”);
//此处将设置上传人脸时的个性化提示语
data.putString(WbCloudFaceContant. CUSTOMER_TIPS_UPLOAD, “已提交审核,请等待结果”);
//设置合作方定制提示语的位置,默认为识别框的下方
//识别框的下方: WbCloudFaceContant.CUSTOMER_TIPS_LOC_BOTTOM
//识别框的上方:WbCloudFaceContant.CUSTOMER_TIPS_LOC_TOP
//此处设置为识别框的上方
data.putInt(WbCloudFaceContant.CUSTOMER_TIPS_LOC,WbCloudFaceContant.CUSTOMER_TIPS_LOC_TOP);
//设置选择的比对类型 默认为权威库网纹图片比对
//此处设置权威数据源对比
data.putString(WbCloudFaceContant.COMPARE_TYPE, WbCloudFaceContant.ID_CARD);
//是否需要录制上传视频 默认不需要,此处设置为不需要
data.putBoolean(WbCloudFaceContant.VIDEO_UPLOAD, false);
//是否对录制视频进行检查,默认不检查,此处设置为不检查
data.putBoolean(WbCloudFaceContant.VIDEO_CHECK, false);
//设置是否打开语音提示,默认关闭,此处设置为关闭
data.putBoolean(WbCloudFaceContant. PLAY_VOICE, false);

//初始化 SDK,得到是否登录 SDK 成功的结果,由 WbCloudFaceVerifyLoginListener 返回登录结果
//【特别注意】建议对拉起人脸识别按钮做防止重复点击的操作
//避免用户快速点击导致二次登录,二次拉起刷脸等操作引起问题
WbCloudFaceVerifySdk.getInstance().initSdk(DemoActivity.this, data, new WbCloudFaceVerifyLoginListener() {
@Override
public void onLoginSuccess() {
//登录成功,拉起 sdk 页面,由 FaceVerifyResultListener 返回刷脸结果
WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk(DemoActivity.this, new WbCloudFaceVerifyResultListener() {
@Override
public void onFinish(WbFaceVerifyResult result) {
if (result != null) {
if (result.isSuccess()) {
Log.d(TAG, "刷脸成功!");
} else {
Log.d(TAG, "刷脸失败!");
}
}
//刷脸结束后,及时释放资源
WbCloudFaceVerifySdk.getInstance().release();
}
});
}
@Override
public void onLoginFailed(WbFaceError error) {
Log.d(TAG, "登录失败!");
//刷脸结束后,及时释放资源
WbCloudFaceVerifySdk.getInstance().release();
}
});