Skip to main content
Use the Sendrealm React Native SDK in React Native apps that own their native android and ios projects. If you use Expo prebuild or EAS builds, use React Native Expo SDK.

Requirements

  • React 18 or newer.
  • React Native 0.76 or newer.
  • Android device or emulator with Google Play services.
  • Physical iOS device for APNs testing.
  • A Sendrealm app ID from the dashboard.
  • Firebase credentials uploaded for Android delivery.
  • APNs credentials uploaded for iOS delivery.
  • Push Notifications enabled for the iOS App ID and Xcode target.
Expo Go is not supported because mobile push requires native code.

Setup Order

  1. Upload Firebase and APNs credentials in Sendrealm.
  2. Install @sendrealm/react-native.
  3. Add Android google-services.json.
  4. Enable iOS Push Notifications capabilities.
  5. Forward iOS AppDelegate notification callbacks.
  6. Rebuild Android and iOS.
  7. Initialize Sendrealm from JavaScript.
  8. Ask for notification permission after explaining the value to the user.
  9. Call login when the user signs in.
  10. Send test pushes on Android and iOS.

Install

Rebuild the native apps after installing:
If your iOS project uses CocoaPods directly:

Android Setup

Android push uses Firebase Cloud Messaging. Before testing Android:
  • Add android/app/google-services.json.
  • Apply the Google Services Gradle plugin if your app does not already use it.
  • Confirm the Firebase Android package name matches your React Native Android applicationId.
  • Upload the Firebase service account JSON in Sendrealm.
  • Test on a device or emulator with Google Play services.
See Mobile Push Credentials for the Firebase walkthrough.

iOS Setup

Before testing iOS:
  • Enable Push Notifications for the Apple App ID.
  • Enable Push Notifications on the Xcode app target.
  • Use a Bundle ID that matches the app configured in Sendrealm.
  • Upload the APNs .p8 key, Key ID, Team ID, Bundle ID, and environment in Sendrealm.
  • Test on a physical iOS device.
If your app sends background updates, enable Background Modes with Remote notifications. If your app sends rich image notifications, add a Notification Service Extension target. Autolinking installs the iOS native module, but bare apps still need to forward APNs callbacks from AppDelegate.swift:
If your app sets UNUserNotificationCenter.current().delegate after Sendrealm is configured, forward notification responses from that delegate so open and action events are tracked:
See Mobile Push Credentials for the APNs walkthrough.

Initialize

Initialize once near app startup:
Use environment: "development" for test devices you want to target separately. Omit it for production. Use apnsEnvironment: "sandbox" for development-signed iOS builds and production for TestFlight or App Store builds. Most apps should keep autoRequestPermission: false and ask permission after an in-app explanation.

Ask For Permission

Check status:
Android 13 and newer show a runtime notification prompt. iOS shows the alert, badge, and sound authorization prompt.
Call logout when the user signs out:

Tags

Use tags for app-observed preferences, state, and behavior:
Do not use SDK tags for authoritative account, billing, security, compliance, or verified profile data. Send those from your backend.

Custom Events

Track app events for segmentation, analytics, or automations:
Use stable event names and avoid sending sensitive data unless your team intentionally wants that data stored in Sendrealm.

Notification Opens

Listen for notification opens when your app needs to route the user:
Read the notification that opened the app from a cold start:

Android Notification Channels

Create Android notification channels when your app needs explicit sound, vibration, or importance behavior:
Android remembers channel behavior after a channel is created. Use a new channel ID for materially different sound or importance behavior.

Diagnostics

Collect support-safe diagnostics during setup:
Confirm diagnostics show:
  • A device ID.
  • Token presence.
  • Expected permission status.
  • Subscribed state unless the user opted out.
  • SDK version.
  • No unexpected SDK error.

Troubleshooting