SenseBot Android API Document
GT3GeetestUtils
API document of SenseBot
Method
GT3GeetestUtils(Context)
Object for developer
Declaration
public GT3GeetestUtils(Context context) |
Parameters
Param | Type | Description |
---|---|---|
context | Context | context |
init(GT3ConfigBean bean)
captcha Initialization
Declaration
public void init(GT3ConfigBean bean) |
Parameters
Param | Type | Description |
---|---|---|
bean | GT3ConfigBean | Configure bean |
startCustomFlow()
Start captcha verification
Declaration
public void startCustomFlow() |
getGeetest()
Continue captcha verification flow
Declaration
public void getGeetest() |
dismissGeetestDialog()
Close the captcha dialog
Declaration
public void dismissGeetestDialog() |
showSuccessDialog()
Show the “Verification Succeeded” prompt
Declaration
public void showSuccessDialog() |
Discussion
When receive the result of secondary verification, if the verification succeeded, call this method.
showFailedDialog()
Show the “Verification failed” prompt
Declaration
public void showFailedDialog() |
Discussion
When receive the result of secondary verification, if the verification failed, call this method.
getVersion()
Get the SDK version
Declaration
public String getVersion() |
Return Value
Return the SDK version. Type: String
destory()
Free memory
Declaration
public void destory() |
Discussion
Please call this method in the lifecycle of onDestroy
changeDialogLayout()
Screen rotation
Declaration
public void changeDialogLayout() |
Discussion
Please call this method in the lifecycle of onConfigurationChanged
.
GT3ConfigBean
Configuration class
setApi1Json(JSONObject)
Set the API1
returned data
Declaration
public void setApi1Json(JSONObject json) |
Parameters
Param | Type | Description |
---|---|---|
json | JSONObject | The returned data when API1 is called |
Discussion
This method is used to configure the returned data of API1
. The following is an example of json.
{ |
The success
,challenge
and gt
are default variables. Please do NOT delete or remove any of them. You can add more variable.
setTimeout(int)
Set duration of captcha loading timeout in millisecond. Default value is 10000.
Declaration
public void setTimeout(int time) |
Parameters
Param | Type | Description |
---|---|---|
time | int | Time in milliseconds, e.g. 10000 |
setWebviewTimeout(int)
Duration of request in Webview timeout in millisecond. Default value is 10000.
Declaration
public void setWebviewTimeout(int time) |
Parameters
Param | Type | Description |
---|---|---|
time | int | Time in milliseconds, e.g. 10000 |
setLang(String)
Set the language for captcha.
Declaration
public void setLang(String lang) |
Parameters
Param | Type | Description |
---|---|---|
lang | String | “zh”–Chinese (Simplified), “zh-tw”–Chinese (Taiwan), “zh-hk”–Chinese (Hong Kong), “en”–English, “id”– Indonesian, “ja”– Japanese, “ko”– Korean, “ru”– Russian, “ar”– Arabic, “es”– Spanish, “pt-pt”– Portuguese, “fr”– French, “de”– German. If the lang is null or it hasn’t been configured, the CAPTCHA will present in the system default language. |
Discussion
If the captcha use unbind mode, please call the init
before setContentView
, then the language modification could be activated immediately.
setCanceledOnTouchOutside(boolean)
Get canceled when touch outside the captcha challenge window. Default value is false
.
Declaration
public void setCanceledOnTouchOutside(boolean cancel) |
Parameters
Param | Type | Description |
---|---|---|
cancel | boolean | true refers to disappear |
setUnCanceledOnTouchKeyCodeBack(boolean)
Set whether the pop-up box disappears by clicking the back button, and disappears by default
Declaration
public void setUnCanceledOnTouchKeyCodeBack(boolean cancel) |
Parameters
Param | Type | Description |
---|---|---|
cancel | boolean | true means not disappear, false means disappear |
setListener(GT3Listener)
Set the listener
Declaration
public void setListener(GT3Listener listener) |
Parameters
Param | Type | Description |
---|---|---|
listener | GT3Listener | GT3Listener is the listener object |
GT3Listener
Callback the Listener
onDialogReady()
Captcha has been loaded successfully
Declaration
public void onDialogReady(String duration) |
Parameters
Param | Type | Description |
---|---|---|
duration | String | Load time, version and so on in json format. |
onReceiveCaptchaCode()
Graph validation results callback
Declaration
public void onReceiveCaptchaCode(int i) |
Parameters
Param | Type | Description |
---|---|---|
i | int | 1 is normal and 0 is failure |
onClosed(int)
Captcha has been closed.
Declaration
public void onClosed(int num) |
Parameters
Param | Type | Description |
---|---|---|
num | int | 1 refer to click at the close button in the captcha; 2 click at the screen to close the captcha; 3 click at the back button to close the captcha |
onDialogResult(String)
Get the verification result callback.
Declaration
public void onDialogResult(String result) |
Parameters
Param | Type | Description |
---|---|---|
result | String | Verification result |
Discussion
The secondary verification require geetest_challenge
,geetest_validate
,geetest_seccode
. Please do NOT delete or remove any of them. You can add more variables.
onSuccess(String)
Return value if the verification succeeded.
Declaration
public void onSuccess(String result) |
Parameters
Param | Type | Description |
---|---|---|
result | String | Return value if the verification succeeded. |
onFailed(GT3ErrorBean)
Return value if the verification failed.
Declaration
public void onFailed(GT3ErrorBean errorBean) |
Parameters
Param | Type | Description |
---|---|---|
errorBean | GT3ErrorBean | Return value if the verification failed. |
Discussion
Please find the details about error code in the error code session.
onButtonClick()
The captcha button has been clicked and the verification flow will start.
Declaration
public void onButtonClick() |
Discussion
This method is used to listen if the captcha button has been click.
GT3GeetestButton
Custom button of captcha in unbind mode
Method
setGeetestUtils(GT3GeetestUtils)
Set the object for GT3GeetestUtils
.
Declaration
public void setGeetestUtils(GT3GeetestUtils geetestUtils) |
Parameters
Param | Type | Description |
---|---|---|
geetestUtils | GT3GeetestUtils | Association |
Discussion
Associate GT3GeetestUtils
with GT3GeetestButton
GT3LoadImageView
Custom loading icon in bind mode.
Method
isGif()
The return value is a GIF or not. Default value is true
, which refers to the return value is GIF. The false
refer to custom view.
Declaration
public boolean isGif() |
Discussion
To custom the loading icon, please set the width and height.
setIconRes(int)
Set GIF resource. When isGif
returns true
, the setting will be activated.
Declaration
public void setIconRes(int iconRes) |
Parameters
Param | Type | Description |
---|---|---|
iconRes | int | Resource ID |
Discussion
Set GIF resource. When isGif
returns true
, the setting will be activated.
setLoadViewWidth(int)
Set the width of icon
Declaration
public void setLoadViewWidth(int loadViewWidth) |
setLoadViewHeight(int)
Set the height of icon
Declaration
public void setLoadViewHeight(int loadViewHeight) |
execute()
Pre-processing the method. Preprocess before loading the icon, e.g. loading animation
Declaration
public void execute() |
Discussion
If the icon is not in gif
format, override isGif()
and it will return false
. Then, override the onDraw()
and other methods. Please refer the demo for the details.