多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
本sdk包含网证认证能力和身份认证能力两大模块。 无论是要使用网证认证能力还是身份认证能力均需要在Application中调用**init**初始化方法。 ``` public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); AppInfo appInfo =new AppInfo("替换成自己的appId","替换成自己的deviceId"); AuthSdk.getInstance(this).init(appInfo, new InitListener() { @Override public void initCallback(boolean inited) { } }); } } ``` ***** # 网证认证能力 第一步、调用网证认证权限请求方法 ~~~ void qrcodeApply(QrcodeApplyRequest authApplyRequest, final QrcodeApplyListener authApplyListener); ~~~ 第二步、调用网证认证核验方法 ~~~ void qrcodeVerify(QrcodeVerifyRequest authVerifyRequest, final QrcodeVerifyListener authVerifyListener); ~~~ ***** # 身份认证能力 第一步、调用身份认证权限请求方法 ``` void authApply(AuthApplyRequest authApplyRequest, final AuthApplyListener authApplyListener); ``` 第二步、调用身份认证核验方法 ~~~ void authVerify(AuthVerifyRequest authVerifyRequest, final AuthVerifyListener authVerifyListener); ~~~ 调用示例 ~~~ private String modeStr=MODES[0]; public static final String [] MODES=new String[]{"0X0F","0X4F","0X1F","0X13","0X1D","0X06","0X16","0X10","0X12","0X40","0X42","0X62","0X32"}; AuthApplyRequest applyRequest=new AuthApplyRequest(); applyRequest.setAuthMode(modeStr); AuthSdk.getInstance(MainActivity.this).authApply(applyRequest, new AuthApplyListener() { @Override public void applyCallback(AuthApplyResponse authApplyResponse) { if(authApplyResponse.isSuccess()){ final AuthVerifyRequest verifyRequest=new AuthVerifyRequest.VerifyRequestBuilder() .setAuthMode(modeStr) .setBizSerialNum(authApplyResponse.getBizSerialNum()) .setName(etName.getText().toString().trim()) .setNumber(etNumber.getText().toString().trim()) .setPhotoData(base64Photo) .setValidDateStart(etStart.getText().toString().trim()) .setValidDateEnd(etEnt.getText().toString().trim()) .build(); AuthSdk.getInstance(MainActivity.this).authVerify(verifyRequest, new AuthVerifyListener() { @Override public void verifyCallback(BaseResponse baseResponse) { if(baseResponse.isSuccess()){ ToastUtil.showToast(MainActivity.this,"验证成功"); }else{ ToastUtil.showToast(MainActivity.this,"验证失败"); } } }); }else{ ToastUtil.showToast(MainActivity.this,"authApplyResponse is fail"); } } }); ~~~