Overview and Resources
The behavior verification HarmonyOS Next SDK is provided for developers integrating the HarmonyOS Next native client.
| Item | Description |
|---|---|
| Product Name | GeeTest CAPTCHA v4 |
| Developer | Wuhan Jiyi Network Technology Co., Ltd. |
| Latest Version (JS) | v1.1.3 |
| Latest Release Date | 2025/5/20 |
| Main Function | The latest generation of CAPTCHA offers smarter solutions to address business losses and security risks caused by automated script/bot attacks. |
| Privacy Policy | GeeTest CAPTCHA v4 Privacy Policy |
| Compliance Guide | GeeTest CAPTCHA v4 Compliance Guide |
| Resource Links | Access the SDK from the dashboard Sign in > Click your account in the top-right corner > SDK Download Center > select the corresponding product SDK. |
Product Introduction
| Item | Description |
|---|---|
| Product Introduction | GeeTest Adaptive CAPTCHA |
| Product version | v1.1.3 |
| Product Developer | Wuhan Jiyi Network Technology Co.,Ltd |
| Main functions of the product | The latest generation of CAPTCHA offers smarter solutions to address business losses and security risks caused by automated script/bot attacks. |
| Personal Information Processing Rules | Geetest User Privacy Policy |
Environmental Requirements
| Item | Resource |
|---|---|
| Development Target | HarmonyOS Next |
| Development Environment | DevEco Studio 5.0.9.300 |
| Compilation Version | API Version 15 Release |
SDK Third-Party Dependencies |
None |
| Package Increment | Verification SDK: 110K |
Related Resources
| Item | Resource Address |
|---|---|
| Product structure process | Communication process, interaction process |
| Error Code List | Error Code List |
| SDK resource bundle | Contact technical support to obtain it, or you can directly install it from the DevEco Studio SDK marketplace (entry: top menu bar Tools - Partner SDK - Search - 极验行为式验证码4.0)。 |
1
/
). |
Installation
Integrating SDK
Manual Download Integration
Download the .zip file from the SDK resource package link to get the latest sdk.
Import SDK
Drag the .har file (including geetest_captcha_harmonyos_vx.y.z_date.har) from the zip package into the libs folder in your project. After dragging the .har file into the libs folder, check if the .har has been added to Library. Add the following code to oh-package.json5 in your project:
"dependencies": { |
Adding Permissions
"requestPermissions": [ |
Obfuscation Rules
The GeeTest SDK has been obfuscated. When integrating, please include the obfuscation rules and do not obfuscate the SDK again.
Configuring Interfaces
Call Logic
- Configure Initialization
- Start Verification
- Get Verification Callback
- Destroy Resources
As shown in the product workflow process, you need to set up Server interface in your backend first,
and configure it with captchaId and Key
you got from GeeTest dashbaord.
Initialization
The SDK initialization configuration can be done in the onCreate or onCreateView methods.
Method Description
public static getClient(context: UIContext): GTCaptcha4Client; |
Parameter Description
| Parameter | Type | Description |
|---|---|---|
context |
UIContext |
The context object must be an entry page instance |
captchaId |
string |
APP_ID, required parameter |
config |
GTCaptcha4Config |
Configuration object, not required |
Start Verification
Start the verification process.
Method Description
public void verifyWithCaptcha(); |
Cancel Verification
Cancel the verification process and close the verification window.
Method Description
public void cancel(); |
Enable/Disable Log Monitoring
Set to enable or disable log monitoring.
Method Description
public void setLogEnable(enable: boolean); |
Get Verification Callback
public GTCaptcha4Client addOnSuccessListener(OnSuccessListener listener); |
Code Example
this.gtCaptcha4Client.addOnSuccessListener({ |
Normal Loading Code Example
onClick(() => { |
Refer to the official demo for detailed example code
Parameter Configuration
Configure parameters using the GTCaptcha4Config.Builder class.
| Definition | Description |
|---|---|
setParams |
Additional parameters passed to the front-end js |
setIsDebug |
Debug mode, default false, set to false in production |
setLanguage |
Specify language, default follows app language |
setIsCanceledOnTouchOutside |
Disappear when clicking outside, default true |
setTimeOut |
Set timeout in ms, default 10000 |
setResourcePath |
Set intermediate address, default loads GeeTest public html file |
setBackgroundColor |
Set background color, default transparent |
setDialogStyle |
Set dialog theme style, default gt4_captcha_dialog_style |
Parameters can be configured using the setParams interface, see the interface documentation for details.
The
setParamsinterface can only receive basic data types, strings, andJSONArraydata.
Handling Errors
Unexpected errors may occur during verification. You can handle them by implementing the addOnFailureListener interface and handling them in the following callback method:
Note: The error callback includes user-initiated verification cancellations, which can be filtered separately.
gtCaptcha4Client.addOnFailureListener({ |
It is strongly recommended to present both an error message and error code to the end user. This will facilitate subsequent troubleshooting.
Please refer to the following list for possible error codes: Error Code List