References
About this guide
This guide is a collection of methods and objects available in the Android SDK of Unico Check.
Constant improvement
Currently only a few objects and code snippets are available for your integration. The goal is to have an auto-generated API Reference.
Error codes
Possible prepareCamera errors
Code | Message |
---|---|
73000 | Unknown and unexpected error. Unico SDK leverages a variety of APIs including camera, storage, security, networking, and more. This return value is a catch-all for errors experienced during normal usage of these APIs. |
73001 | <property> is required |
73002 | <property> must be an instance of <class> |
73003 | <class> with name <name> is not available to inject. |
73004 | Class type must be a function or a class. |
73005 | Could not find the <locale> locale. |
73006 | Could not find text: <text> . |
73100 | Unable to connect to internet. |
73200 | Could not find the Unico SDK JSON file. |
73201 | Could not load the Unico SDK JSON file. |
73202 | Unico SDK JSON file is invalid. |
73204 | Unable to initialize the SDK, please configure the environment on setEnviroment method of build. |
73300 | Could not authenticate this application. |
73301 | Could not authenticate this application. |
73302 | Authentication token not found. |
73303 | Current host is not registered. |
73400 | Could not initialize camera. |
73401 | Could not load ML models for this camera. |
73402 | The Key could not be verified due to connectivity issues on the user's device. |
73403 | This device/platform/browser/version combination is not supported by SDK. |
73404 | Device is in landscape display orientation. The SDK can only be used in portrait display orientation. |
73405 | Device blocked due to multiple failed attempts. |
73406 | The Session was cancelled, the SDK was opened in an IFrame. |
73407 | The SDK was not fully loaded. |
73500 | Could not get session. |
73501 | Could not get session. |
73502 | Session token not found. |
73600 | Could not find camera resource. |
73601 | Could not start camera in production mode. |
74000 | Invalid hexadecimal. |
74001 | Object is not a UnicoTheme |
Possible openCamera errors (Liveness with interaction)
Code | Message |
---|---|
73700 | Could not parse camera response. |
73704 | The user pressed the cancel button and did not complete the session. |
73706 | The camera access is prevented because either the user has explicitly denied permission or the user's device is configured to not allow access by a device policy. |
73707 | The session was canceled due to the app being terminated, put to sleep, an OS notification, or the app was placed in the background. |
73708 | The session was cancelled because device is in landscape mode. The user experience of devices in these orientations is poor and thus portrait is required. |
73710 | The session was cancelled because the user was unable to complete a Session in the default allotted time or the timeout set by the developer. |
73715 | The session was cancelled because not all guidance images were configured. |
73716 | The session was cancelled because SDK was unable to start the camera on this device. |
73717 | The session was cancelled because the user was in a locked out state. |
73718 | The session was cancelled because of an unknown and unexpected error. SDK leverages a variety of iOS APIs including camera, storage, security, networking, and more. This return value is a catch-all for errors experienced during normal usage of these APIs. |
73720 | The developer programmatically called the session cancel API. |
73721 | The session was cancelled due to a device orientation change during the session. |
73722 | The session was cancelled because the document is not ready. |
73723 | The session was cancelled because there was another session in progress. |
73724 | The session was cancelled because the camera was opened in an iFrame. |
73728 | Connection error, please use HTTPS to connect. |
73729 | Browser not supported, please open in another browser. |
73730 | Unable to initialize an active liveness session because of an unknown and unexpected license error. |
73731 | Unable to initialize an active liveness session because the license has expired. |
73732 | Unable to initialize an active liveness session because Origin is not permitted. |
73800 | Could not encrypt response. |
73900 | Could not get system information. |
Possible openCamera errors (Liveness without interaction)
Code | Message |
---|---|
100 | Ops! Algo inesperado aconteceu |
101 | Usuário negou permissão de acesso a câmera |
102 | Timeout, sessão expirada por tempo máximo para captura excedido |
103 | Timeout, sessão expirada por inatividade |
104 | Captura encerrada por estar com orientação no modo LANDSCAPE |
105 | Captura encerrada por inatividade de tela |
106 | Captura encerrada pelo usuário desligar o display |
107 | O elemento com id #box-camera não foi encontrado |
108 | Tipo de câmera inválido |
109 | Modelos não foram carregados previamente |
110 | Métodos de Callback não implementados corretamente |
111 | Não foi possível baixar os modelos, pode ser erro de diretório |
112 | Browser não suportado |
113 | Não foi possível criptografar a sessão, tente novamente |
114 | Câmera ocupada por outra aplicação |
115 | Captura encerrada pelo usuário por cancelar a sessão |
116 | A sessão foi cancelada por que a câmera não pode ser aberta em um iFrame |
Type Declarations - TypeScript
If you are using TypeScript in your project, you can add this Type Declaration file in your project by creating and including it in the folder src/@types:
Then, include the following content in this file:
declare module 'unico-webframe' {
export interface UnicoTheme {
colorSilhouetteNeutral: string
colorSilhouetteSuccess: string
colorSilhouetteError: string
backgroundColor: string
colorText: string
backgroundColorComponents: string
colorTextComponents: string
backgroundColorBoxMessage: string
colorTextBoxMessage: string
backgroundColorButtons: string
colorTextButtons: string
htmlPopupLoading: string
colorCancelButton: string
colorProgressBar: string
}
export class UnicoConfig {
setProjectNumber(projectNumber: string): UnicoConfig
setProjectId(projectId: string): UnicoConfig
setMobileSdkAppId(mobileSdkAppId: string): UnicoConfig
setHostname(hostname: string): UnicoConfig
setHostInfo(hostInfo: string): UnicoConfig
setHostKey(hostKey: string): UnicoConfig
}
export class UnicoThemeBuilder {
setColorSilhouetteSuccess(color: string): UnicoThemeBuilder
setColorSilhouetteError(color: string): UnicoThemeBuilder
setColorSilhouetteNeutral(color: string): UnicoThemeBuilder
setBackgroundColor(color: string): UnicoThemeBuilder
setColorText(color: string): UnicoThemeBuilder
setBackgroundColorComponents(color: string): UnicoThemeBuilder
setColorTextComponents(color: string): UnicoThemeBuilder
setBackgroundColorButtons(color: string): UnicoThemeBuilder
setColorTextButtons(color: string): UnicoThemeBuilder
setBackgroundColorBoxMessage(color: string): UnicoThemeBuilder
setColorTextBoxMessage(color: string): UnicoThemeBuilder
setHtmlPopupLoading(content: string): UnicoThemeBuilder
setColorCancelButton(color: string): UnicoThemeBuilder
setColorProgressBar(color: string): UnicoThemeBuilder
build(): UnicoTheme
}
export class SelfieCameraType {
name: string
code: number
constructor(name: string, code: number)
}
export class DocumentCameraType {
name: string
code: number
description: string
constructor(name: string, code: number, description?: string)
}
export class SDKEnvironmentType {
name: string
constructor(name: string)
}
export const SelfieCameraTypes: {
NORMAL: SelfieCameraType
SMART: SelfieCameraType
}
export const DocumentCameraTypes: {
CNH: DocumentCameraType
CNH_FRENTE: DocumentCameraType
CNH_VERSO: DocumentCameraType
CPF: DocumentCameraType
OTHERS: (description: string) => DocumentCameraType
RG_FRENTE: DocumentCameraType
RG_VERSO: DocumentCameraType
RG_FRENTE_NOVO: DocumentCameraType
RG_VERSO_NOVO: DocumentCameraType
}
export const SDKEnvironmentTypes: {
PROD: SDKEnvironmentType
UAT: SDKEnvironmentType
}
export class LocaleType {
name: string
constructor(name: string)
}
export const LocaleTypes: {
PT_BR: LocaleType
EN_US: LocaleType
ES_MX: LocaleType
ES_ES: LocaleType
}
export type SuccessPictureResponse = {
encrypted: string
base64: string
}
export type ErrorPictureResponse = {
code: number
message: string
type: string
stack: any[]
}
export type CallbackCamera = {
on: {
success: (obj: SuccessPictureResponse) => void
error: (error: ErrorPictureResponse) => void
}
}
interface CameraOpener {
open: (callback: CallbackCamera) => void
}
export interface MainView {
prepareSelfieCamera: (
config: UnicoConfig | string,
cameraType: SelfieCameraType,
) => Promise<CameraOpener>
prepareSelfieCameraForIFrame: (
config: UnicoConfig | string,
cameraType: SelfieCameraType,
) => Promise<CameraOpener>
prepareDocumentCamera: (
config: UnicoConfig | string,
cameraType: DocumentCameraType,
) => Promise<CameraOpener>
}
export class UnicoCheckBuilder {
setTheme(theme: UnicoTheme): UnicoCheckBuilder
setModelsPath(path: string): UnicoCheckBuilder
setResourceDirectory(path: string): UnicoCheckBuilder
setEnvironment(environmentType: SDKEnvironmentType): UnicoCheckBuilder
setCustomFooterLogoDirectory(path: string): UnicoCheckBuilder
setLocale(localeType: LocaleType): UnicoCheckBuilder
build(): MainView
}
export class UnicoException extends Error {
constructor(message: string, public code?: number) {
super(message)
this.name = 'UnicoException'
}
}
}