Native Core
The io.kade.sdk.core module is a Kotlin Android library with React Native dependencies explicitly excluded.
Integrate encrypted geofence checks, continuous verification, persisted fingerprints, and native device signals directly in a Kotlin application.
KadeClient.getInstance(context) is the high-level native entry point. It owns configuration, encryption, pings, continuous checks, and fingerprint submission while retaining only the application context.
The io.kade.sdk.core module is a Kotlin Android library with React Native dependencies explicitly excluded.
Obtain the singleton with an Android Context, start it before calling ping or training methods, and stop ongoing work when the protected flow ends.
suspend version and a callback version. Native Core exposes evaluateEmail(EvaluateEmailOptions) for fire-and-forget registration email evaluation. The server always answers with an empty response; the verdict is visible only to operators. It does not expose network-based location estimation APIs. React Native bridge methods are intentionally excluded from this guide.Version 1.1.0 completes the native Kade rename. Use KadeClient, KadeCore, KadeConfig, KadeErrorCodes, and KadeSdkException.
io.kade.sdk.core package. Persisted storage keys keep their original com.videntrix.geofence prefix so existing installs keep their identifiers, and the React Native bridge is now named KadeSdk.The Android Core SDK is not currently distributed as a standalone public Maven artifact. There are no public Maven coordinates or repository installation commands to use.
The current source module is configured with minSdk 23, compileSdk 34, targetSdk 34, Java 17, and Kotlin JVM target 17. These facts describe the source module, not a public release.
After Kade supplies the native package, add it according to the delivery-specific instructions. Do not invent a remote dependency coordinate or include the React Native bridge in a native-only app.
android {
compileSdk 34
defaultConfig {
minSdk 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
}When Kade supplies Core as source, its module declares coroutines, AndroidX Core, Security Crypto, Lifecycle Process, Google Play services Location and Block Store, Play Integrity, and OkHttp dependencies. Follow the supplied packaging instructions to determine whether your host must declare any of them directly.
Obtain the singleton, start it, and issue a ping only after start succeeds. From a coroutine, use the suspend versions; failures throw a KadeSdkException.
import io.kade.sdk.core.KadeClient
import io.kade.sdk.core.KadeConfig
import io.kade.sdk.core.KadeSdkException
import io.kade.sdk.core.PingOptions
val client = KadeClient.getInstance(applicationContext)
lifecycleScope.launch {
try {
client.start(KadeConfig(apiToken = "your-api-token", regionId = 123))
val response = client.ping(
PingOptions(userId = "player-123", source = "login", email = "player@example.com"),
)
if (response.blocked == true) {
println("Blocked: ${response.code ?: "unknown"}")
} else {
println("Inside: ${response.inside}, area: ${response.area?.name ?: "none"}")
}
} catch (error: KadeSdkException) {
// error.code: a location code or GEOFENCE_INIT / GEOFENCE_PING;
// error.httpStatus when the server answered with an error status.
println("Kade failed: ${error.code} ${error.httpStatus ?: ""} ${error.message}")
}
}The same flow with callbacks:
val client = KadeClient.getInstance(applicationContext)
val config = KadeConfig(
apiToken = "your-api-token",
regionId = 123,
)
client.start(config) { startResult ->
startResult.fold(
onSuccess = {
client.ping(
options = PingOptions(
userId = "player-123",
source = "login",
email = "player@example.com",
),
) { pingResult ->
pingResult.fold(
onSuccess = { response ->
if (response.blocked == true) {
println("Blocked: ${response.code ?: "unknown"}")
} else {
println("Inside: ${response.inside}")
println("Area: ${response.area?.name ?: "none"}")
}
},
onFailure = { error ->
println("Kade ping failed: $error")
},
)
}
},
onFailure = { error ->
println("Kade startup failed: $error")
},
)
}start initializes on the SDK's background coroutine scope, hydrates persisted client identity, derives the encryption key, and then invokes (Result<Unit>) -> Unit (or returns, for the suspend version). Do not treat the client as ready before it succeeded. Callbacks arrive on a background thread; a failure found up front (not started yet) calls back at once on the calling thread. The suspend versions resume in the caller's context.Core declares network and foreground location permissions. Android still requires the host app to request dangerous location permissions at runtime.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>private val core by lazy { KadeCore.getInstance(this) }
private val locationPermission =
registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions(),
) {
when (core.getLocationPermissionStatus(this)) {
PermissionStatus.GRANTED -> beginVerification()
else -> showPreciseLocationRequired()
}
}
fun requestKadeLocation() {
// Lets getLocationPermissionStatus tell "never asked" from "denied" later.
core.markLocationPermissionRequested()
locationPermission.launch(KadeCore.LOCATION_PERMISSIONS)
}| API | Behavior |
|---|---|
KadeCore.LOCATION_PERMISSIONS | What to request: fine (what pings need) and coarse. Android 12+ lets the user pick approximate. |
markLocationPermissionRequested() | Call right before showing the system dialog. Android has no "not determined" state; this flag lets the status tell "never asked" from "denied". |
getLocationPermissionStatus(activity: Activity? = null) | GRANTED with fine (precise) location, which a geofence check needs; NOT_DETERMINED before the first request; DENIED otherwise, coarse-only included. Pass the current Activity when there is one: it recognises a denial even when your app asked without the flag. |
If your Kade policy permits a server-side check without device location, set skipLocation = true in PingOptions. Confirm that policy with Kade; this is not a network-estimate API.
These signatures are from the native Kotlin Core module, not its React Native bridge.
GEOFENCE_PING when the client has not been started.skipLocation is false) it reports that once through onPingError and doesn't start, so a later call can start it.visitorId.EvaluateEmailOptions has the JavaScript SDKs' option names: email (required), firstName, lastName, userId, dob, gender, occupation, phone, postalCode, addressLine, referrerPlayerId, referralCode, trafficSource, platform, metadata (your own key/value pairs such as ad click IDs and campaign tags: strings, numbers and booleans; anything else is dropped; use facebookClickId, googleClickId, redtrackClickId, microsoftClickId, tiktokClickId and utmCampaign for the identifiers Kade recognises) and includeLocation (default true: attach the last known fix only when the permission is already held; never prompts).val fingerprint = client.currentFingerprint()
println("Visitor ID: ${fingerprint.visitorId}")
client.sendFingerprintForTraining("player-123") { result ->
result.fold(
onSuccess = { json -> println("Server response: $json") },
onFailure = { error -> println("Submission failed: $error") },
)
}PingResponse, AddressSessionLocation, GeoLocation, DeviceInfo, FingerprintResult, MobileMarkers and the detector results implement KadeJsonRepresentable: toJson() returns a new JSONObject with the same keys the React Native SDK hands JavaScript (absent when null).
val response = client.ping(PingOptions(userId = "player-123"))
log(response.toJson().toString(2))
// {"inside":true,"status":200,"interval":10000,"distanceToBorder":5120.4,"regionId":123, ...}| Field | Type and default | Behavior |
|---|---|---|
apiToken | String, required | Workspace API token. |
serverUrl | String, https://api.kade.io | API base URL. |
regionId | Int?, null | Default region; ping-level value overrides it. |
signingSecret | String?, null | Enables request signing when non-empty. |
locationStrategy | LocationStrategy, RACE | Location retrieval strategy. |
locationMaxAgeMs | Long, 120,000 | Preferred cached-fix age. This is the floor of a dynamic reuse window. |
locationMaxAgeCapMs | Long, 600,000 | Upper bound for the dynamic cached-fix reuse window. |
locationMaxStalenessRadius | Double, 100.0 | Staleness radius used by location selection. |
locationAccuracy | LocationAccuracy, HIGH | HIGH, BALANCED, or LOW. |
debug | Boolean, false | Enables verbose SDK logging. |
val options = PingOptions(
userId = "player-123",
silent = false,
skipLocation = false,
source = "deposit",
regionId = 123,
email = "player@example.com",
firstName = "Player",
lastName = "One",
)Every option has a default. source is a free-form flow tag, regionId overrides configuration for that ping, and identity fields are associated with the server-side client record.
Register handlers before starting continuous checks and stop them when the protected flow ends. Core includes AndroidX process lifecycle support for its continuous controller.
client.onPingResponse = { response ->
runOnUiThread {
updateAccessState(response)
}
}
client.onPingError = { error: KadeSdkException ->
runOnUiThread {
// A location code (location off or not permitted: the loop stops),
// or GEOFENCE_PING_ERROR for any other failure.
handleLocationSetupError(error.code)
}
}
client.startContinuousPing(
PingOptions(
userId = "player-123",
source = "session",
),
)
// When the verified flow ends:
client.stopContinuousPing()
// When disposing the entire integration:
client.destroy()startContinuousPing returns before doing anything if startup has not completed.onPingError and the loop doesn't start.onPingResponse and onPingError are invoked on a background thread. Marshal UI work to the main thread.destroy() leaves the singleton available for a later successful start.Branch on blocked first, tolerate nullable fields, and keep failed Result values separate from server verdicts.
fun handle(response: PingResponse) {
if (response.blocked == true) {
denyAccess(
code = response.code,
message = response.message,
)
return
}
if (response.inside) {
allowAccess(response.area?.name)
} else {
showOutsideRegion(response.distanceToBorder)
}
if (response.requestLocation == true) {
// Revisit permission and location services before the next check.
}
}| Field | Type | Meaning |
|---|---|---|
inside | Boolean | Whether the server resolved the client inside the relevant geofence. |
status | Int | Server response status value. |
message, code | String? | Optional response detail and machine-readable code. |
interval | Int | Server-provided interval; model default is 10,000. |
distanceToBorder | Double | Distance value returned by the server. |
regionId | Int? | Resolved region when present. |
area | PingArea? | Matched area with id and name. |
blocked | Boolean? | Explicit block decision when supplied. |
requestLocation | Boolean? | Reserved: the server does not send it yet (asks the client to obtain location). |
deviceTrustTtl | Int? | Reserved: the server does not send it yet (device-trust lifetime in ms). |
fun handleLocationSetupError(code: String) {
when (code) {
KadeErrorCodes.LOCATION_PERMISSION_MISSING ->
requestLocationPermission()
KadeErrorCodes.LOCATION_PERMISSION_PRECISE_REQUIRED ->
explainPreciseLocation()
KadeErrorCodes.LOCATION_SERVICES_DISABLED ->
promptToEnableLocationServices()
else ->
showVerificationUnavailable()
}
}Every failure from KadeClient, as a callback's failed Result, a thrown exception from a suspend version, or through onPingError, is a KadeSdkException. It has already been reported to Kade; you don't need to report it again.
| Property | Type | Meaning |
|---|---|---|
code | String | Stable code to match on (below); the same strings the React Native SDK rejects with. |
httpStatus | Int? | The HTTP status when the server answered with an error status, else null. |
message | String? | What went wrong, for logs. Not stable. |
cause | Throwable? | The exception Core caught, when there is one. |
KadeErrorCodes | Code | When |
|---|---|---|
LOCATION_PERMISSION_MISSING | LOCATION_PERMISSION_MISSING | No location permission. |
LOCATION_PERMISSION_PRECISE_REQUIRED | LOCATION_PERMISSION_PRECISE_REQUIRED | Only approximate location granted. |
LOCATION_SERVICES_DISABLED | LOCATION_SERVICES_DISABLED | Location turned off on the device. |
START | GEOFENCE_INIT | start failed. |
PING | GEOFENCE_PING | ping failed: not started, no response, or an HTTP error. |
CONTINUOUS_PING | GEOFENCE_PING_ERROR | A continuous-ping failure other than location. |
FINGERPRINT | GEOFENCE_FINGERPRINT | sendFingerprintForTraining failed. |
EVALUATE_EMAIL | GEOFENCE_EVALUATE_EMAIL | evaluateEmail failed, or email was empty. |
A blocked ping is not an error: it is a PingResponse with blocked == true and a code.
Talk to Kade for SDK access, approved packaging, credentials, and integration guidance for your application.