hCaptcha/hcaptcha-android-sdk

hCaptcha failed: No internet connection(7)

OlMi1 opened this issue · 0 comments

OlMi1 commented

Hey there,
I implemented the SDK like so:

hCaptcha
                .addOnSuccessListener(new OnSuccessListener<HCaptchaTokenResponse>() {
                    @Override
                    public void onSuccess(HCaptchaTokenResponse response) {
                        // Successul verification. The resulting token must be passed to your backend to be validated.
                        String userResponseToken = response.getTokenResult();
                        Log.d("hCaptcha", "hCaptcha success. Token: " + userResponseToken);
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(HCaptchaException e) {
                        // Error handling here: trigger another verification, display a toast, etc.
                        Log.d("hCaptcha", "hCaptcha failed: " + e.getMessage() + "(" + e.getStatusCode() + ")");
                    }
                })
                .addOnOpenListener(new OnOpenListener() {
                    @Override
                    public void onOpen() {
                        // Usefull for analytics purposes
                        Log.d("hCaptcha", "hCaptcha is now visible.");
                    }
                });

        final HCaptchaConfig hCaptchaConfig = HCaptchaConfig.builder()
                .siteKey(sitekey)
                .size(HCaptchaSize.NORMAL)
                .theme(HCaptchaTheme.DARK)
                .build();
        hCaptcha.setup(hCaptchaConfig).verifyWithHCaptcha();

and while connected to WiFi it throws hCaptcha failed: No internet connection(7). Disabling WiFi and using mobile data opens a hCaptcha popup for a split second only to result in the same error. What is going wrong here?