Skip to Content

CaptchaFox for Android

You can protect your native Android apps (Views and Jetpack Compose) using the official Android library . It requires Android 7.0 (API level 24) or later.

Setup

  1. In the CaptchaFox portal, create a new site configuration using the Android integration

  2. Add the library to your app module’s build.gradle.kts. It is published to Maven Central:

    dependencies { // Views and the dialog implementation("com.captchafox:captchafox-android:1.0.0") // Jetpack Compose implementation("com.captchafox:captchafox-android-compose:1.0.0") }
  3. Follow the usage instructions in the readme 

  4. Enter the sitekey and domain from your site configuration

  5. Show the Captcha on your application screen and verify the resolved token in your backend

Example

import com.captchafox.android.CaptchaFoxConfiguration val configuration = CaptchaFoxConfiguration( siteKey = "YOUR_SITEKEY", baseUrl = "https://YOUR_DOMAIN", ) @Composable fun SignUpScreen() { var showsCaptcha by remember { mutableStateOf(false) } Button(onClick = { showsCaptcha = true }) { Text("Sign up") } if (showsCaptcha) { CaptchaFoxDialog( configuration = configuration, onDismissRequest = { showsCaptcha = false }, onVerify = { token -> // Send the token to your backend. }, ) } }
Last updated on