Native iOS and Android risk signals

Kade React Native SDK

Collect device integrity, fingerprint, network, and location signals, then evaluate geofence and fraud policy through native Swift and Kotlin modules.

1.1.0 current version React Native 0.71+ iOS 13+ Native Swift and Kotlin

Overview

The package exports a KadeSDK class, public TypeScript types, and a Permissions namespace. React Native autolinking connects the JavaScript wrapper to the native modules.

Native collection

Location, device fingerprinting, integrity checks, secure storage, sensors, and network probes run in the SDK's own native code. No additional native peer package is required.

Foreground lifecycle

Continuous checks pause when the app backgrounds and resume against the server-provided interval when the app becomes active. Version 1.1.0 does not perform background location checks.

Native builds are required. This package cannot run in Expo Go because Expo Go does not include its custom native modules. Use a bare React Native app or an Expo development/production build.

What the SDK collects

Each ping sends the following to Kade, on behalf of and as instructed by the operator that integrates the SDK:

Wi-Fi network names or BSSIDs, contacts, photos, and other app content are not collected. Kade processes this data as a processor under the operator's data processing agreement and does not sell or share it with other operators.

The operator is responsible for giving players notice of this collection and, where the law of the player's jurisdiction requires it for precise location or device data, for obtaining consent before calling ping() or startContinuousPing(). The OS location permission prompt is not a substitute for that notice. Where consent is refused, call the SDK with the location opt-out so only the IP-based estimate is used, or do not call it. Every ping is processed as a separate event with its own decision; a retry is recorded as a second ping, not merged with the first.

Install

The canonical package is @kade-technologies/react-native-sdk version 1.1.0. It is a restricted package on GitHub Packages, not the public npm registry. Configure the @kade-technologies scope and an authorized GitHub token before installing.

Configure npm

Add this project-level .npmrc. Supply GITHUB_PACKAGES_TOKEN through your local environment or CI secret store; do not commit the token.

@kade-technologies:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}

Use a GitHub personal access token with read:packages permission. The package owner must grant your GitHub account or team package access.

Install the package

npm install @kade-technologies/react-native-sdk@1.1.0

# Or with Yarn after the same registry configuration
yarn add @kade-technologies/react-native-sdk@1.1.0
Registry access is required for every fresh install. A plain npm install without the scoped registry and a token will attempt the wrong registry or fail authorization.

Migration and compatibility

Remove @videntrix/react-native-geofence-sdk, install @kade-technologies/react-native-sdk, and rename the JavaScript class to KadeSDK.

Install exactly one package name. Installing the old and new packages together causes native autolinking collisions.

The CocoaPods and React Native module name is KadeSdk, and native bridge events use the KadeSdk.* prefix. Legacy public exports have been removed. Android classes live in the io.kade.sdk.core and io.kade.sdk.rn packages. Persisted storage keys keep their original com.videntrix.geofence prefix so existing installs keep their identifiers.

Bare React Native setup

iOS

The podspec supports iOS 13 or newer and autolinks both the native core and React Native bridge. Keep the deployment target at 13.0 or higher, add the foreground location usage text, then install pods.

# ios/Podfile
platform :ios, '13.0'

target 'YourApp' do
  config = use_native_modules!
  use_react_native!(path: config[:reactNativePath])
end
<!-- ios/YourApp/Info.plist -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>We verify your location to confirm you are in a licensed region.</string>
cd ios
pod install
cd ..

The pod uses Swift 5.7. No manual pod 'KadeSdk' entry is needed when React Native autolinking is enabled.

Android

The included React Native configuration points autolinking at the package's bridge class. The library manifest declares:

<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" />

You do not need to register the package manually or duplicate these permissions in the app manifest. Before a location-enabled ping() or startContinuousPing(), the wrapper requests runtime location permission and gives Android an opportunity to upgrade coarse access to precise access.

The SDK does not request Wi-Fi scan permissions and does not read BSSIDs. The permissionRationale constructor option is accepted for forward compatibility, but the current native bridges do not display rationale copy, so show your own explanation before requesting permission when the OS requires one.

Expo setup

The bundled config plugin writes the iOS foreground location description and ensures the Android location and network permissions are present.

{
  "expo": {
    "plugins": [
      [
        "@kade-technologies/react-native-sdk",
        {
          "locationUsageDescription": "We verify your location to confirm you are in a licensed region."
        }
      ]
    ]
  }
}
npx expo prebuild

# Build and install a native development client
eas build --profile development
Not supported in Expo Go. Run expo prebuild and use a development build, or let EAS Build generate the native projects. Changing plugin options requires regenerating/rebuilding the native app.

Quick start

Create one instance, attach an error observer, initialize it, and run a ping. Public operations initialize the native client automatically, but explicit startup makes initialization failures easier to handle.

import KadeSDK from '@kade-technologies/react-native-sdk';

const sdk = new KadeSDK({
  apiToken: 'your-api-token',
  regionId: 123,
  locationAccuracy: 'high',
  debug: __DEV__,
  permissionRationale: {
    title: 'Location access',
    message: 'Kade uses your location to confirm your licensed region.',
  },
});

sdk.onError((error, context) => {
  console.warn(`Kade SDK error in ${context}`, error);
});

await sdk.init();

const response = await sdk.ping({
  userId: 'player-123',
  source: 'login',
  email: 'player@example.com',
});

if (response.blocked) {
  handleBlocked(response.code, response.message);
} else {
  console.log(response.inside, response.area?.name);
}

Omit skipLocation for normal GPS-backed verification. Pass skipLocation: true when the flow intentionally relies on server-side network location and must not request device location.

Configuration

apiToken is the only required constructor option. serverUrl defaults to https://api.kade.io.

OptionTypeBehavior
apiTokenstringRequired API token sent with SDK requests.
serverUrlstring?Overrides the default Kade API origin.
regionIdnumber?Default region; a ping-level region overrides it.
signingSecretstring?Enables HMAC request signing in the native client.
locationStrategy'race' | 'sequential'?race runs high- and low-accuracy acquisition in parallel; sequential tries high accuracy first. The default is race.
locationMaxAgenumber?Preferred cached GPS fix age in milliseconds. Default 120,000. This is the floor of a dynamic reuse window that grows with how little the device has moved, up to locationMaxAgeCap.
locationMaxAgeCapnumber?Upper bound for the dynamic cached-fix reuse window in milliseconds. Default 600,000.
locationMaxStalenessRadiusnumber?Fallback maximum displacement in metres when speed is unavailable. Default 100.
locationAccuracy'high' | 'balanced' | 'low'?Native location accuracy tier. Default high.
permissionRationale{ title, message }?Rationale copy for runtime permission prompts. Accepted but not currently displayed by the native bridges.
debugboolean?Enables verbose native diagnostics. Lifecycle, warning, and error logs still emit when false.

Core API

new KadeSDK(config: KadeConfig)

Creates an instance and validates that apiToken is present. Native resources are prepared by init() or the first operation that initializes automatically.

onError(handler: SdkErrorHandler): this

Observes JavaScript and native errors handled by the SDK and returns the instance for chaining. Continue to catch rejected method promises; initialization and ping failures can still reject.

init(): Promise<void>

Starts the native client, installs event listeners, and prepares SDK state. Repeated calls after initialization are no-ops.

ping(options?: PingOptions): Promise<PingResponse>

Runs one geofence and risk evaluation. Unless skipLocation is true, it handles runtime location permission before calling the native ping client.

getFingerprint(userId?: string): Promise<FingerprintResult | FingerprintServerResponse>

Without a user ID, returns the local device fingerprint result. With a user ID, the native client can send the fingerprint for server-side association and return the enriched server response.

evaluateEmail(options: EvaluateEmailOptions): Promise<void>

Posts registration identity data to /public/email-check. It returns no verdict to the app; results are operator-only. Network errors are reported through the SDK error path and swallowed so registration is not interrupted.

startContinuousPing(options?: PingOptions, callback?: (response: PingResponse, error?: Error) => void): Promise<void>

Starts native recurring checks and reuses the supplied options for every check. Responses and loop errors are delivered to the callback.

stopContinuousPing(): Promise<void>

Stops the loop and location watcher and clears its callback.

destroy(): Promise<void>

Stops continuous checks, removes native listeners, releases native resources, and allows a later call to initialize again.

Email evaluation

await sdk.evaluateEmail({
  email: 'new.user@example.com',
  firstName: 'New',
  lastName: 'User',
  userId: 'player-123',
});

// The promise resolves without a client-visible verdict.

Your own fields: metadata

Send your traffic channel as trafficSource, under the label you use yourself. Anything else you know about the registration that has no option of its own — ad click IDs from the install attribution, campaign tags, your own fields — goes in metadata, under names you choose. Kade stores it with the check.

await sdk.evaluateEmail({
  email: 'new.user@example.com',
  userId: 'player-123',
  trafficSource: 'Instagram',
  metadata: {
    facebookClickId: attribution.fbclid,
    googleClickId: attribution.gclid,
    utmCampaign: attribution.campaign,
    installSource: 'tiktok',
  },
});

Kade recognises these names for the identifiers it uses:

Key (use this name)Also recognisedWhat it is
facebookClickIdfbclid, fbClickIdMeta (Facebook / Instagram) ad click ID: the fbclid parameter of the landing URL.
googleClickIdgclid, gClickIdGoogle Ads click ID: the gclid parameter of the landing URL.
redtrackClickIdrtclickid, rtkclickidRedTrack click ID.
microsoftClickIdmsclkidMicrosoft Advertising click ID: the msclkid parameter of the landing URL.
tiktokClickIdttclidTikTok ad click ID: the ttclid parameter of the landing URL.
utmCampaignutm_campaign, campaignThe campaign tag (utm_campaign).

Keys are matched ignoring case and _ . -; when several names for the same ID are sent, the name in the first column wins. Any other key is stored as sent, so you can add fields without waiting for an SDK release. Values must be flat (string, number or boolean); anything else is dropped, never an error. The server keeps at most 50 keys (letters, digits, _, ., -; up to 64 characters) and strings up to 512 characters. Send click IDs as strings, never as numbers: a numeric ID longer than about 15 digits loses its last digits when it is turned into JSON, before it reaches Kade.

React Native SDK 1.1.0 and later send metadata, on iOS and Android; earlier versions drop it. The Capacitor SDK takes the same option.

Location permissions

Import the package-level Permissions namespace when your UI needs to inspect or request location access before a ping.

import {
  Permissions,
  type PermissionStatus,
} from '@kade-technologies/react-native-sdk';

const current: PermissionStatus = await Permissions.getLocationStatus();

if (current !== 'granted') {
  const result = await Permissions.requestLocation({
    title: 'Location access',
    message: 'Location is required to verify your licensed region.',
  });

  if (result !== 'granted') {
    showLocationSettingsHelp(result);
  }
}
HelperReturn valueBehavior
Permissions.getLocationStatus()Promise<PermissionStatus>Reads granted, denied, restricted, or notDetermined.
Permissions.requestLocation(rationale?)Promise<PermissionStatus>Requests foreground location. Concurrent calls share one in-flight native request; the first rationale wins.

Normal ping() and startContinuousPing() calls perform this permission flow automatically unless skipLocation: true is set.

Continuous ping and lifecycle

The native loop pings immediately, then schedules each subsequent check using the server's response.interval.

await sdk.startContinuousPing(
  {
    userId: 'player-123',
    source: 'gameplay',
    regionId: 123,
  },
  (response, error) => {
    if (error) {
      console.warn('Continuous ping failed', error);
      return;
    }

    if (response.blocked) {
      handleBlocked(response.code);
      return;
    }

    updateLocationState(response.inside, response.distanceToBorder);
  },
);

// Await this when the protected flow ends.
await sdk.stopContinuousPing();

Background

Timers and the location watcher stop when the app enters the background. Version 1.1.0 is foreground-only and does not request always-on location.

Foreground

If the last server interval elapsed while paused, the SDK pings immediately. Otherwise it waits only the remaining interval.

The native loop stops after a blocked response or HTTP status 403/451. It also adapts location watching to the server interval and disables the watcher for skipLocation.

Types and responses

PingOptions

interface PingOptions {
  userId?: string;
  silent?: boolean;
  skipLocation?: boolean;
  source?: string;
  regionId?: number;
  email?: string;
  firstName?: string;
  lastName?: string;
}

PingResponse

interface PingArea {
  id: number;
  name: string;
}

interface PingResponse {
  inside: boolean;
  status: number;
  message?: string;
  code?: KadeResponseCode;
  interval: number;
  distanceToBorder: number;
  regionId?: number;
  area?: PingArea;
  blocked?: boolean;
  requestLocation?: boolean;
  deviceTrustTtl?: number;
}

requestLocation and deviceTrustTtl are reserved: the server does not send them yet. When it does, requestLocation will ask the native client to attach a fresh location to the next ping, and deviceTrustTtl will be a millisecond window in which the native client may skip expensive integrity probes.

Fingerprint results

interface FingerprintResult {
  visitorId: string;
}

interface FingerprintServerResponse {
  clientId: string;
  fingerprintRequestCount?: number; // not sent by the server
  visitorId?: string;
  confidence: {
    score: number;
    comment: string;
  };
  ip: string;
  ja3?: string;
  ja4?: string;
  device: {
    userAgent?: string;
    browser?: string;
    os?: string;
  };
}

Mobile block codes

Branch on blocked === true first. The code union permits future strings, so unknown codes must still be treated as blocked. Codes starting with LOCATION_ other than LOCATION_PERMISSION_MISSING are produced by the SDK on the device, not by the server. They arrive as rejected promises or pingError events rather than as a blocked response, so handle those paths as well.

CodeMeaning
BLOCKEDGeneric security or compliance rejection.
BLACKLISTEDThe client was already blacklisted.
DEV_TOOLS_DETECTEDDebugger-style inspection contributed to the block.
VPN_DETECTEDVPN, proxy, hosting, datacenter, or related network evidence contributed to the block.
DEVELOPER_MODE_DETECTEDiOS/Android developer mode, ADB, or an attached debugger contributed to the block.
EMULATOR_DETECTEDAn emulator or simulator contributed to the block.
LOCATION_PERMISSION_MISSINGForeground location permission was not granted.
LOCATION_PERMISSION_PRECISE_REQUIREDPrecise location was required but unavailable.
LOCATION_SERVICES_DISABLEDDevice-level location services are disabled.
LOCATION_TIMEOUTThe SDK timed out waiting for a usable location fix.
LOCATION_UNAVAILABLEThe SDK could not obtain a usable location fix.

Web and mobile differences

These KadeSDK methods are Web-only: estimateLocation(), primeLocation(), and requestLocationPermission(). They are not methods on the React Native KadeSDK class.

On React Native, use Permissions.getLocationStatus() and Permissions.requestLocation() for explicit UI flows. For the normal case, call ping() or startContinuousPing() and let the SDK perform automatic foreground permission handling.

React Native

Uses native GPS, integrity, sensor, secure-storage, and network probes. It pauses continuous work while the app is backgrounded.

Web

Uses browser APIs and exposes browser-specific location priming and network-estimation methods. Those methods do not transfer to the native package.

Need help with your integration?

Talk to the Kade team about package registry access, native setup, permission UX, configuration, or production rollout.

Contact Kade