Good news!

It is quite simple to integrate hCaptcha with your native Android app today.

(Note: if you are using Flutter, please see our hCaptcha Flutter guide.)

Simply create an HTML file with a hCaptcha form (see hCaptcha docs) and host that on your web site. Then load the URL in a WebView and create a bridge between Java and Javascript (addJavascriptInterface).

Android Activity:

WebView mWebView = (WebView) findViewById(R.id.webview);

mWebView.getSettings().setJavaScriptEnabled(true);

mWebView.getSettings().setBuiltInZoomControls(false);

mWebView.loadUrl("https://your.server/hcaptcha_form.html");

mWebView.addJavascriptInterface(new BridgeWebViewClass(this), "BridgeWebViewClass");

Bridge Class:

public class BridgeWebViewClass { @JavascriptInterface public void hCaptchaCallbackInAndroid(String h_response){

log.d("hCaptcha", "token" + h_response); } }

Now from your HTML file you can run the Bridge Class as a Javascript function:

<div class="h-captcha" data-sitekey="YOUR_CAPTCHA_SITE_KEY" data-callback="captchaResponse"></div> <script type="text/javascript">

function captchaResponse(token){ BridgeWebViewClass.hCaptchaCallbackInAndroid(token); } </script>

Finally, pass the response token returned above to your backend server, and have it call siteverify to check that the token is valid.

Let us if you have any questions!

Credit: this method was inspired by a similar StackOverflow answer.