HuiYanOsApi
(API class), HuiYanOsConfig
(parameter configuration class), and HuiYanOsAuthCallBack
and HuiYanAuthEventCallBack
(result callback classes).API | Feature Description |
Initializes the service. | |
Releases resources. | |
Sets the key actions in the liveness detection and face comparison process. | |
Performs liveness detection and face comparison. This API can be called to complete the entire process. |
public static void init(Context context)
Type | Parameter | Description |
Context | context | App context information |
public static void release()
public static void setAuthEventCallBack(HuiYanAuthEventCallBack authEventCallBack)
Type | Parameter | Description |
huiYanAuthEventCallBack | Callback for key liveness detection and face comparison actions |
public static void startHuiYanAuth(final String startToken, final HuiYanOsConfig startConfig, HuiYanOsAuthCallBack authCallBack)
Type | Parameter | Description |
String | startToken | Business token requested from the server for starting liveness detection and face comparison |
startConfig | Configuration parameter | |
authCallBack | liveness detection and face comparison result |
HuiYanOsConfig
is the configuration entity class during eKYC SDK startup, which mainly contains the following attributes:Type | Name | Description | Default Value |
pageColorStyle | Color pattern used for liveness detection and face comparison | PageColorStyle.Light | |
String | authLicense | Name of the license file applied for by client for liveness detection and face comparison authorization | Empty |
long | authTimeOutMs | Liveness detection and face comparison timeout period | 10000 ms (10s) |
boolean | isDeleteVideoCache | Whether to delete the local cache of the liveness detection and face comparison video | true |
boolean | isShowGuidePage | Whether to open the guide page for liveness detection and face comparison | true |
boolean | isNeedBestImage | Whether to return the best frame | false |
LanguageStyle | languageStyle | Language type | Auto |
String | languageCode | Language code (see Language codes for Android), which is used together with languageStyle | Empty |
String | backUpIPs | List of backup IPs | Empty |
String | backUpHost | Backup domain | Empty |
AuthUiConfig | authUiConfig | UI configuration items | Empty |
PageColorStyle Value | Description |
PageColorStyle.Light | Light color pattern |
PageColorStyle.Dark | Dark color pattern |
LanguageStyle Value | Description |
LanguageStyle.AUTO | Auto |
LanguageStyle.ENGLISH | English |
LanguageStyle.SIMPLIFIED_CHINESE | Simplified Chinese |
LanguageStyle.TRADITIONAL_CHINESE | Traditional Chinese |
LanguageStyle.CUSTOMIZE_LANGUAGE | Custom language |
Type | Name | Description | Default Value |
videoSize | Resolution during liveness detection and face comparison | 480P | |
boolean | isShowCountdown | Whether to display the countdown control | true |
boolean | isShowErrorDialog | Whether to display the error dialog | true |
int | authLayoutResId | Custom layout resID exported from FaceID, which is -1 by default if not adjusted. | -1 |
int | feedBackErrorColor | Color of exception tips (format: 0xFFFFFFFF), which is -1 by default if not adjusted. | -1 |
int | feedBackTxtColor | Color of success tips (format: 0xFFFFFFFF), which is -1 by default if not adjusted. | -1 |
int | authCircleErrorColor | Color of background round frame for incorrect action (format: 0xFFFFFFFF), which is -1 by default if not adjusted. | -1 |
int | authCircleCorrectColor | Color of background round frame of correct action (format: 0xFFFFFFFF), which is -1 by default if not adjusted. | -1 |
int | authLayoutBgColor | Color of liveness detection and face comparison UI background (format: 0xFFFFFFFF), which is -1 by default if not adjusted. | -1 |
VideoSize Value | Description |
VideoSize.SIZE_480P | 480P |
VideoSize.SIZE_720P | 720P |
Type | Name | Description | Default Value |
String | token | The token used in the current liveness detection and face comparison process. | Empty |
String | bestImage | Base64-encoded data of the best frame image for liveness detection and face comparison. | Empty |
/*** Result callback** @author jerrydong* @since 2022/6/10*/public interface HuiYanOsAuthCallBack {/*** Successful liveness detection and face comparison** @param authResult Result*/void onSuccess(HuiYanOsAuthResult authResult);/*** Failed liveness detection and face comparison** @param errorCode Error code* @param errorMsg Error message* @param token Token used in this liveness detection and face comparison process*/void onFail(int errorCode, String errorMsg, String token);}
/*** Callback for liveness detection and face comparison event in FaceID SDK*/public interface HuiYanAuthEventCallBack {/*** Callback for event notification when liveness detection and face comparison `tips` change** @param tipsEvent Key `tips` event*/void onAuthTipsEvent(HuiYanAuthTipsEvent tipsEvent);/*** Liveness detection and face comparison event** @param authEvent authEvent*/void onAuthEvent(HuiYanAuthEvent authEvent);/*** Callback for the creation of the authenticated main view** @param authView*/void onMainViewCreate(View authView);/*** Callback for UI repossession*/void onMainViewDestroy();}
Error Codes | Error Code | Error Description |
HY_NETWORK_ERROR | 210 | Network request exception. |
HY_LOCAL_REF_FAILED_ERROR | 211 | Check failed during local SDK initialization. The common exceptions are license file nonexistence or license expiration. |
HY_USER_CANCEL_ERROR | 212 | The user actively cancels the liveness detection and face comparison process. |
HY_INNER_ERROR_CODE | 213 | An internal exception of the SDK occurred, causing the liveness detection and face comparison process to be stopped. |
HY_DO_NOT_CHANGE_ERROR | 214 | Applications are switched during liveness detection and face comparison, causing the process to be stopped. |
HY_CAMERA_PERMISSION_ERROR | 215 | An exception occurred while getting the camera. |
HY_INIT_SDK_ERROR | 216 | The liveness detection and face comparison method is directly called before the "init()" method is called. |
HY_VERIFY_LOCAL_ERROR | 217 | Local face detection failed. |
HY_PERMISSION_CHECK_ERROR | 218 | The permissions required by the local SDK are insufficient. |
HY_APP_STOP_ERROR | 219 | If reflectSequence of startAuthByLightData is null , you stopped the liveness detection and face comparison process. |
HY_CHECK_LIVE_DATA_ERROR | 220 | Failed to verify the light sequence parameter. |
HY_INITIALIZATION_PARAMETER_EXCEPTION | 221 | An exception occurred while directly calling the method for setting light sequence parameters without getting the device configuration. |
HY_VERIFY_LOCAL_TIME_OUT | 222 | Local motion detection timed out. |
HY_PREPARE_TIME_OUT | 223 | Preparation timed out (between camera launch and the first detection of face). |
HY_CHECK_PERMISSION_ERROR | 224 | Failed to apply for the camera permission inside the SDK. |
HY_USE_BACK_CAMERA_WITH_REFLECTIVE_ERROR | 227 | Reflective mode please do not use back camera |
HY_ILLEGAL_TOKEN | 228 | Illegal TOKEN |
Was this page helpful?