目录

Android


一 产品介绍/快速入门

       自助面签仅由用户自己即可完成整个面签的流程,用户按照指引开启自助面签后,可以自动播放一段产品简介或风险揭示类型的视频,然后客户按照指引朗读声明内容,并按照要求进行拍照留存,合同签名等,面签结束后上传视频至云端。

实现的相关功能点如下:

√  音视频通话

√  本地录制

√  播放产品简介或风险揭示视频

√  朗读声明

√  拍照留存

√  合同签名

√  防出框比对

二 开发者手册

1. 请联系相关人员开通租户权限,获取【企业账号】。

2. (按需提供)发起人脸识别需要姓名、证件号、大头照的base64(可有可无)。如果业务系统已经有了人脸识别,需要提供人脸识别的结果和大头照的base64。

3. 自助面签需要提供播放的视频文件地址(可以是多个),朗读声明的文字。

三 接口开发手册

3.1 build.gradle配置

app目录下的build.gradle文件中android块中配置相关的sourceSets标签,如果没有使用该标签则新增,代码如下

sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}

dependencies {
    implementation files('libs\\newlibrary-release.aar')
    implementation files('libs\\libspinner.aar')
    implementation files('libs\\loadLibrary.aar')
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.qianwen:okhttp-utils:3.8.0'
    implementation 'com.squareup.okhttp3:okhttp:4.0.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.0-RC1'
    implementation 'com.squareup.retrofit2:retrofit:2.0.2'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
    implementation 'io.reactivex:rxandroid:1.1.0'
    implementation 'io.reactivex:rxjava:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.github.yalantis:ucrop:2.2.4'
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'com.github.vondear:RxTools:v1.7.8.1'
    implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar'
    implementation 'org.greenrobot:greendao:3.2.2'
    implementation 'com.qianwen:update-app:3.5.2'
    implementation files('libs\\WbCloudFaceReflectLiveSdk-v2.1.91-09c9fe1.aar')
    implementation files('libs\\WbCloudNormal-v4.0.0-9267e3d.aar')
}

如果有android.V4 包冲突,请删除本项目中V4包的引用,升级为androidX中对应的引用更换为

implementation 'androidx.appcompat:appcompat:1.1.0'

3.2 权限声明

添加权限声明到AndroidManifest.xml文件

<!-- 为了能使用OpenGLES 2.0 API,你必须在你的manifest中添加以下声明: --> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <!-- 如果你的应用要使用纹理压缩功能,你必须还要声明设备需要支持什么样的压缩格式 --> <supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<supports-gl-texture android:name="GL_OES_compressed_paletted_texture" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

3.2.1开发环境中设置的compileSdkVersion高于23Android6.0)时以上时,请注意添加相机,录音和内部存储空间的动态权限 

Manifest.permission.CAMERA
Manifest.permission.RECORD_AUDIO
Manifest.permission.WRITE_EXTERNAL_STORAGE
Manifest.permission.READ_PHONE_STATE

3.2.2 检查是否开启动态权限

·      /**  * 查看是否权限 返回值为true代表权限已经全部开启  */ public boolean checkPermission(String... permissions) {    //如果android版本低于Android6.0,默认为开启权限(无危险权限)    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return true;    PackageManager pm = contextWeakReference.get().getPackageManager();    for(String permission : permissions) {       if (PackageManager.PERMISSION_GRANTED !=             pm.checkPermission(permission, contextWeakReference.get().getPackageName())) {          return false;       }    }    return true; }

3.2.3 添加缺省的动态权限

·         /**  * 获取需要申请权限的列表  */ private List<String> findDeniedPermissions(String[] permissions) {    List<String> needRequestPermissionList = new ArrayList<>();    for (String perm : permissions) {       if (ContextCompat.checkSelfPermission(contextWeakReference.get(), perm) != PackageManager.PERMISSION_GRANTED) {          needRequestPermissionList.add(perm);       } else {          if (ActivityCompat.shouldShowRequestPermissionRationale(                activityWeakReference.get(), perm)) {             needRequestPermissionList.add(perm);          }       }    }    return needRequestPermissionList; }

3.3 集成sdk Library

sdk library集成到 本SDK 依赖到项目

把libs文件夹中的arr包,放置项目的libs文件夹下

3.4 定义项目配置清单

  需要在本项目的AndroidManifest.xml 文件中加入provider 标签,并且修改标签中authorities 属性为自己项目的包名即可,如下标注位置

<provider

            android:name="androidx.core.content.FileProvider"

            tools:replace="android:authorities"

            android:authorities="com.bufeng.videoSDK"

            android:exported="false"

            android:grantUriPermissions="true">

            <meta-data

                android:name="android.support.FILE_PROVIDER_PATHS"

                android:resource="@xml/file_paths" />

        </provider>

需要注意

l  远程面签需要 合作方 通过API 获取 队列信息。然后发起面签。

l  自主面签面签结束后,如果没有网络或不想上传的情况下,可以点击退出系统,然后合作方保存本次未上传视频的名称和相关信息,然后下次直接调用上传的接口。


3.5 初始化sdk

项目中自定义Application需继承SDK中的PureApplication对象,并且重写attachBaseContext方法 ,方法如下。

                                                             @Override

                                                             protected void attachBaseContext(Context base) {

                                                                 super.attachBaseContext(base);

                                                                 MultiDex.install(base);

                                                             }

                                                    

3.5.1 登录SDK

调起SDK方法PureVersionSDK类中的doLoginSDK方法,参数如下:

                                                             /**

                                                                  * 登录SDK

                                                                  * @param context         上下文

                                                                   * @param accountId       企业账号

                                                                  * @param business_id     业务ID

                                                                  * @param assist_id       辅助ID

                                                                  * @param companyName     公司名称

                                                                  * @param doLoginCallBack 登录回调接口

                                                                  */

                                                    

其中 DoLoginCallBack 登录回调接口格式如下:

                                                             public interface DoLoginCallBack {

                                                                    void onSuccess(DoLoginResult doLoginResult);

                                                                    void onFail(String message);

                                                             }

                                                    

onSuccess方法中启动面签服务

3.5.2 启动面签

调起SDK方法PureVersionSDK类中的startInterview方法,参数如下:

                                                             /**

                                                                  *

                                                                  * @param activity 当前activity实例

                                                                  * @param interviewInformation 面签实体类

                                                                  * @param onExitVideoCallBack   退出面签回调

                                                                  */

                                                    

3.6 User 活体核身实体类

                                                             //是否使用人脸识别

                                                                private boolean useFaceIdentification = false;

                                                             //使用人脸识别必填参数

                                                             //人员名称

                                                             private String name = "";

                                                             //证件号

                                                             private String idNumber = "";

                                                             //人脸识别失败是否继续业务流程

                                                             private boolean nextFail = false; 

                                                             //是否使用默认人脸对比源

                                                             private boolean useDefaultFaceImg = false;

                                                             //默认人脸比对源(useDefaultFaceImg true必填,false选填)

                                                             private String defaultComparisonSource ;

                                                             //不使用人脸识别必填参数(自定义设置识别结果)

                                                             //人脸识别结果 1成功 2失败 3未识别

                                                             private int faceResult = 1;   

                                                             //人脸对比相似度(0.0—100.0

                                                             private String similarity = "0.0";

                                                    

3.7 自助面签跳转未上传视频列表

                                                              调起SDK方法PureVersionSDK类中的startUploadList方法,参数如下: 

                                                                  /**

                                                             v    *

                                                                  * @param context 上下文

                                                                  * @param accountId 企业账号

                                                                  * @param business_id 业务编号

                                                                  * @param assist_id 辅助编号

                                                                  * @param companyName 公司名称

                                                                  * @param userNick 用户昵称(唯一必填)

                                                                  */

                                                    

3.8活体人脸核身

请联系合作方配置活体人脸核身相关参数后调用

                                                     /**

                                                          * 人脸识别

                                                          *

                                                          * @param businessId 业务ID

                                                          * @param userList   人脸识别用户集合

                                                          * @param userIndex  当前要进行人脸核身用户索引

                                                          */

                                                         private void startFace(String businessId, List userList, int userIndex,) {

                                                             PureVersionSDK.getInstance().startFaceIdentification(MainActivity.this, businessId, userList, userIndex, new FaceResultCallback() {

                                                                 @Override

                                                                 public void onFaceResultSuccess() {

                                                                   //人脸识别成功

                                                                 }

                                                    

                                                                 @Override

                                                                 public void onFaceResultFailed(String result) {

                                                     //人脸识别失败

                                                                 }

                                                                 @Override

                                                                 public void onStartFaceResultActivity(int index,

                                                     List userInfoList) {

                                                                   //继续识别或者启动面签服务 

                                                     startInterView(index, userInfoList

                                                                 }

                                                             });

                                                         }

  1. 视频面签类型及传递参数                                        

                                      //自助面签类型

                                                     private int faceType = FaceType.INTERVIEW_TYPE_ZZ;

                                                     //用户昵称(唯一必填) 

                                                     private String nickName;

                                                     //风险视频地址集合(必填)

                                                     private List riskVideoList;

                                                     //合同文件(必填)

                                                     private String signatureUrl;

                                                     //朗读文字(选填)

                                                     private String readText;

                                                     //人脸比对时间间隔(选填)

                                                     private int faceCompareTime = 10; 

                                                     //人脸比对源(选填  data:image/jpg;base64,开头)

                                                     //对比优选级:人脸识别>默认比对图>人脸比对图片

                                                     PureApplication.getInstance().setFaceComparePicture(compareSourcePicture);

                                                     //活体人脸检测集合(可自定义)

                                                     private List userInfoList;

                                                                                                                                   

四 版本更新日志

2023.09.21

自助面签增加横竖屏切换功能;

2023.05.08

本地录制横竖屏模式适配

照片水印横竖屏模式适配

2022.12.06

照片水印横竖屏模式适配

2022.09.02

优化Intent传递图片数据崩溃问题

优化话术播报文字变色字号显示问题

优化地理位置信息解析逻辑

2022.08.11

自助面签增加人脸出框识别功能

2022.08.08

优化自助面签长时间录制掉线问题

优化视频水印功能

2022.04.19

优化人脸比对功能

人脸出框相似度修改为后台控制

优化话术播报卡顿问题

2022.01.15

优化活体人脸核身功能

增加活体人脸核身错误码/错误信息回调

2021.11.27

优化自助面签视频上传功能

新增地理位置上报功能

2021.05.11

优化视频播放功能,提高视频播放速度

优化部分机型无法调起原生相机拍照功能

2021.03.23

自助面签增加合同浏览/合同签名功能

remotelyRiskVoideUrl 传入本地视频地址

修改文件夹路径可查看

修改安卓分辨率

修复自助被踢下线的bug

本地风险视频地址 copyAssetAndWrite方法实现

/**

        

2020-12-25 版本号 2.1.1

自助视频保存地址

选择面签模式排序

2020-12-03

public void exitVideoCallBack(String latitudeLongitude ,String locationInformation) {}

新增 : latitudeLongitude ;locationInformation; 经纬度 ;地理位置信息

2020-11-24

requestpersonInfo方法

新增远程面签风险视频地址,仅支持https并且与坐席端同域;

新增水印公司名称必传;

新增功能: 拍照水印; 无人工坐席面签; 网络检测转自助