跳转到主要内容

错误处理

Android SDK 的所有错误处理均集中在本节。onErrorAcessoBio 回调接收一个包含 code (Int) 和 description (String) 的 ErrorBio 对象。

处理回调
override fun onErrorAcessoBio(error: ErrorBio) {
when (error.code) {
73002 -> { /* camera permission denied — redirect to app settings */ }
73006 -> { /* running on emulator — physical device required */ }
73100 -> { /* no internet connection */ }
else -> { /* generic error handling */ }
}
}
生命周期回调

onErrorAcessoBio 外,SDK 还会触发:

  • onUserClosedCameraManually() — 用户手动关闭了相机。
  • onSystemClosedCameraTimeoutSession() — 会话因超时而过期。
  • onSystemChangedTypeCameraTimeoutFaceInference() — 13 秒内未检测到人脸;SDK 切换至手动采集模式。
错误代码

所有错误代码均来自 UnicoException 枚举,并通过 ErrorBio(code, message) 传递。message 字段包含 SDK 的精确字符串 — 请勿修改或本地化。

代码消息描述
73001Context invalid传递给 SDK 的 Android context 无效
73002Did not grant permission to open camera用户拒绝了摄像头权限
73003The lest API is 21(LOLLIPOP设备 API 级别低于最低要求 (API 21)
73004Could not find implementation interface callback iAcessoBioSelfieiAcessoBioSelfie 接口未实现
73005Could not find implementation interface callback iAcessoBioDocumentiAcessoBioDocument 接口未实现
73006Unable to open camera on emulatorsSDK 不在模拟器上运行 — 请使用实体设备
73007Unknown and unexpected error in WebApp…WebApp 通用错误(摄像头、存储、安全、网络)
73100Unable to connect to internet.无网络连接
73200Please inform the config object or json file name未提供配置对象或 JSON 文件
73202Unable to parse json fileJSON 配置文件格式错误
73204Unable to initialize the SDK, please configure the environment on setEnviroment method of build初始化前未调用 setEnvironment()
73300Unable to get unico authentication object获取认证对象失败
73301Unable to parse object解析认证响应失败
73302Could not find the unico token未找到 Unico 认证令牌
73303Current host is not registeredBundle 标识符未在 SDK Key 中注册
73400Could not initialize camera摄像头初始化失败
73701Could not find active liveness import未找到活体检测模块
73703Unable to get active liveness session获取活体检测会话失败
73718The Session was cancelled because of an unknown and unexpected error…未知内部会话错误
73721The Session can't be performed: attempts limit exceeded.会话已取消 — 超过采集尝试次数限制
73722The Session can't be performed: face alignment timeout.会话已取消 — 人脸对齐超时
73726An error happened during video recording活体检测期间视频录制错误
73727No actions found in a video视频中未检测到活体动作
73740The user pressed the do not consent button and did not complete the Session.用户拒绝了授权
73800Could not build encrypted key.构建加密 JWT 失败
73801The Session of SDK was cancelled because of an unknown and unexpected error.未知内部 SDK 会话错误
73802The Session was cancelled because of an unknown and unexpected error…会话已取消 — 缺少必填 JWT 字段
73900Erro ao analisar imagem分析采集图像时出错
73901É necessário implementar a interface AcessoBioListenerAcessoBioListener 接口未实现
73902É necessário insirir um valor maior que 40 segundos no método: setTimeoutSession.setTimeoutSession 的值必须大于 40 秒
73903Arquivo de configuração corrompido. Verifique o arquivo json e tente novamente.配置文件已损坏 — 请验证并重试
73904Erro ao finalizar processo完成采集流程时出错
73905Unable to open document camera无法打开文档摄像头
73906Document type uninformed未指定文档类型
74001onSuccess: not implemented when using open:webAppToken:User Journey 的 onSuccess 回调未实现
74100Could not prepare SDK-S准备 SDK 组件失败
74101No URL token was provided.未提供 journey 的 URL 令牌
74102Environment type was not specified.未配置 Environment (PROD/UAT)
737120Unable to initialize liveness活体检测 activity 无法初始化
737220Capture could not start采集流程无法启动
737320Transaction could not start事务无法发起
737321The Session was cancelled because of an unknown and unexpected error. This return value is a catch-all for errors experienced during normal usage of these APIs. Try again.会话提供方通用错误 — 请重试
REST API 错误代码

上述代码为 SDK 回调错误。REST API 错误代码(HTTP 状态码系列)单独记录在 API 参考 > 错误代码