> >

Android FAQ

Q:Why specify the language through the API method but it does not take effect?
A:The number of languages that can be configured in different versions is different. Please confirm whether the current version supports the specified language. If your version supports the language, please confirm whether the connected SDK is the latest version obtained from the backend of Geetest and use the local dependency method. The remote dependencies are not supported.

Q:Is it possible to remove or customize the loading bar?
A:Yes, we support it. However, the user experience will be decreased in the poor network environment because there is no loading signal on the page. The custom loading processes are as follows:

  1. Specify the path of the loading resource in setParams.

    Map<String, Object> params = new HashMap<>();
    params.put("loading", "./loading.gif");
    GTCaptcha4Config builder = new GTCaptcha4Config.Builder()
    .setParams(params);
  2. Turn off sdk loading and implement your custom loading bar

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState){
    super.onViewCreated(view, savedInstanceState);
    Map<String, Object> params = new HashMap<>();
    params.put("loading", ""); //The laoding field passes a null value to close loading bar
    params.put("bgColor", "#00000080"); //set the mask of load on the front end, css color value
    GTCaptcha4Config config = new GTCaptcha4Config.Builder()
    .setParams(params)
    .setDialogStyle("demo_dialog_style")//customize the theme of the captcha dialog box, remove the native mask layer and prevent occlusion loading
    .build();
    gtCaptcha4Client = GTCaptcha4Client.getClient(activity)
    .init("your captcha_id", config);
    }

    public void click() {
    showLoading(); // add your custom loading bar
    gtCaptcha4Client.addOnSuccessListener(new GTCaptcha4Client.OnSuccessListener {
    @Override
    public void onSuccess(boolean status, String response) {
    if (status) {
    //TODO turn on the secondary verification
    } else {
    //TODO user's answer is incorrect
    }
    }
    })
    .addOnFailureListener(new GTCaptcha4Client.OnFailureListener {
    @Override
    public void onFailure(String error) {
    }
    })
    .addOnWebViewShowListener(new GTCaptcha4Client.OnWebViewShowListener{
    @Override
    public void onWebViewShow() {
    dismissLoading(); // close your custom loading bar
    }
    })
    .verifyWithCaptcha();
    }
<style name="demo_dialog_style" parent="android:Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<!-- Whether to use a black translucent background outside the display area -->
<!-- Change to false to remove the mask -->
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:padding">0dp</item>
</style>
Was this helpful?
Send