接入文档

接入示例

最近更新时间:2020-09-11 16:05:06

权威库网纹图片比对、自带对比源对比接入示例:

# 在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.putBoolean(WbCloudFaceContant.SHOW_SUCCESS_PAGE, false);
  //是否展示刷脸失败页面,默认展示,此处设置为不显示
  data.putBoolean(WbCloudFaceContant.SHOW_FAIL_PAGE, false);
//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);
//设置选择的比对类型  默认为权威库网纹图片比对
//权威数据源比对 WbCloudFaceContant.ID_CARD
//自带比对源比对  WbCloudFaceContant.SRC_IMG
//仅活体检测  WbCloudFaceContant.NONE
//此处设置权威数据源对比
  data.putString(WbCloudFaceContant.COMPARE_TYPE, WbCloudFaceContant.ID_CARD);
//是否需要录制上传视频 默认需要,此处设置为需要 
  data.putBoolean(WbCloudFaceContant.VIDEO_UPLOAD, true);
  //是否对录制视频进行检查,默认不检查,此处设置为不检查
  data.putBoolean(WbCloudFaceContant.VIDEO_CHECK, false);
  //设置是否打开闭眼检测,默认不检测,此处设置为检测
  data.putBoolean(WbCloudFaceContant.ENABLE_CLOSE_EYES, true);
//设置是否打开语音提示,默认打开,此处设置为关闭
  data.putBoolean(WbCloudFaceContant. PLAY_VOICE, false);

//初始化 SDK,得到是否登录 SDK 成功的结果 
WbCloudFaceVerifySdk.getInstance().initSdk(
  MainActivity.this,
  data,a
  //由WbCloudFaceVerifyLoginListener返回登录结果
  new WbCloudFaceVerifyLoginListener() {
            @Override
            public void onLoginSuccess() {
             //登录成功,拉起 sdk 页面
  WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk (MainActivity.this,
new WbCloudFaceVerifyResultListener() {
     //由FaceVerifyResultListener返回刷脸结果
       @Override
public void onFinish(WbFaceVerifyResult result) { 
    if(result != null) {
         if (result.isSuccess()) {
              Log.d(TAG, "刷脸成功!");
           } else {
              Log.d(TAG, "刷脸失败!");
           }
         }
      });
    }
            @Override
            public void onLoginFailed(WbFaceError error) {
              //登录失败
              ...
         }