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
-
In the CaptchaFox portal, create a new site configuration using the Android integration
-
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") } -
Follow the usage instructions in the readme
-
Enter the sitekey and domain from your site configuration
-
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