Skip to main content
sdk

React Native SDK

active
Audience: developerUpdated 2026-08-02

The React Native TurboModule bridge (@binoban/react-native) over the Binoban Native SDK's Android and iOS outputs — the exhaustive configuration and method reference. It is not an independent implementation: every call crosses the bridge into native code (Android via io.binoban.sdk:sdk-android, iOS via the binoban XCFramework), so its behavior — identity, batching, the apiHost requirement — matches the native platforms.

For installing the package, initializing the bridge (createClient + BinobanProvider + useBinoban), and sending a first event, start with the Track from React Native tutorial. The underlying native initialization this bridge wraps is documented on the Native SDK tutorials — Android · iOS.

Requirements: react >= 18, react-native >= 0.71, New Architecture (TurboModules) — on the old architecture the native module resolves to null and the SDK is an inert no-op; Android minSdk 24+; iOS per React Native's min_ios_version_supported. Check the compatibility matrix for the current version and publish status.

Config options

OptionDefaultPurpose
credentials.android / credentials.iOSRequired. { apiKey, sourceIdentifier } per platform. Android and iOS credentials are independent — you can point them at different sources if your setup requires it, though most integrations use the same sourceIdentifier on both.
apiHost'' (required)API endpoint. Blank leaves the client inert — no default, no cloud fallback.
debugfalseVerbose native logging.
collectDeviceIdtrueCollect a device identifier.
trackAppLifecycleEventstrueAuto-track app open/close/update.
useLifecycleObservertrueHook into the app lifecycle observer.
trackDeepLinkstruePassed through to the native layer, where deep-link tracking requires a plugin the React Native bridge does not register. No deep-link events are emitted through React Native today.
flushAt20Send after this many queued events.
flushInterval30…or after this many seconds.
autoAddSegmentDestinationtrueInternal batching destination toggle.
disableTelemetryfalseDisable SDK-health telemetry.
telemetryHost''Telemetry endpoint, if enabled.
uploadMaxRetries3Upload retry ceiling.
backoffBaseMillis1000Retry backoff base.
backoffFactor2.0Retry backoff multiplier.
backoffMaxMillis60000Retry backoff ceiling.
maxFilesPerFlush20Batched files per flush.

An optional onError(e) callback on createClient's config surfaces JS and native failures; native errors set e.method to "native" or "native:<ClassName>".

Method reference

MethodSignatureNotes
track(event: string, properties?: JsonMap) => voidRecord an action.
identify(userId: string, userTraits?: UserTraits) => voidAssociate the current person with your user ID and traits.
flush() => voidSend queued events immediately.
reset() => voidClear identity and start a new anonymousId — call on logout.
anonymousId() => string | undefinedRead the current anonymous ID.
userId() => string | undefinedRead the current user ID, if identified.
deviceId() => string | undefinedRead the device ID, when collectDeviceId is on.
notify(payloadData: JsonMap) => voidTrigger a local notification.
setDeviceToken(token: string) => voidRegister a push token.
onNotificationInteraction(listener) => { remove(): void }Subscribe to push interaction events.
getInitialNotificationInteraction() => Promise<NotificationInteraction | null>The interaction that cold-started the app, if any.
didReceiveNotificationResponse / willPresentNotification / didReceiveRemoteNotificationiOS host-forwarding callsNo-ops on Android.
screen, group, alias are not exposed

The underlying Native SDK marks screen(), group(), and alias() as internal on both Android and iOS, so the React Native bridge does not expose them either. This mirrors the native platforms — it is not an RN-specific gap.

Push notifications

The bridge exposes the native push surface through a single JS API. For the step-by-step integration see App push in React Native.

Android configuration

Unlike native Android, the bridge does not take a configuration object — it reads the notification icon and channel from AndroidManifest.xml meta-data when the first push arrives:

Meta-data keyDefault
io.binoban.sdk.reactNative.default_notification_iconYour app icon.
io.binoban.sdk.reactNative.push_channel_idDEFAULT_NOTIFICATION_CHANNEL_ID
io.binoban.sdk.reactNative.push_channel_nameGeneral
io.binoban.sdk.reactNative.push_channel_descriptionEmpty.

The channel is created at IMPORTANCE_HIGH; an existing channel with that id is reused unchanged. POST_NOTIFICATIONS is still your app's to declare and request on Android 13+.

notify(payloadData)

Hand a received data message to the SDK to be displayed and tracked. Payloads whose source is not "binoban" are ignored, so it is safe to call for every message your push library delivers. On iOS, forwarding through didReceiveRemoteNotification does the same job.

Interactions

{
notificationUuid: string;
type: 'DELIVERED' | 'CLICKED' | 'CLOSED' | 'FAILED' | 'OPENED';
actionId?: string;
uri?: string;
customData?: Record<string, string>;
reason?: string;
}

onNotificationInteraction(listener) returns a subscription — call remove() to stop listening. getInitialNotificationInteraction() returns the tap that cold-started the app, if any, and is consumed once: call it at startup, since a launching tap is delivered before JS has had a chance to subscribe.

The bridge extends the SDK's default handler, so Binoban's own delivery and click tracking continues regardless of what your listener does.

iOS does not open uri itself — read it from the interaction and route it.

Platform wiring

What you do
AndroidNothing extra. The SDK's notification trampoline delivers interactions to JS once you subscribe.
iOSThe SDK registers no UNUserNotificationCenterDelegate, so the host must forward. Either call didReceiveNotificationResponse / willPresentNotification / didReceiveRemoteNotification from JS, or forward from a native AppDelegate to the SDK's Swift functions — the bridge emits to JS either way. The three JS methods are no-ops on Android.

See Push events for what all of this emits.

Next steps