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.
Setup Order
- Upload Firebase and APNs credentials in Sendrealm.
- Install
@sendrealm/react-native. - Add Android
google-services.json. - Enable iOS Push Notifications capabilities.
- Forward iOS AppDelegate notification callbacks.
- Rebuild Android and iOS.
- Initialize Sendrealm from JavaScript.
- Ask for notification permission after explaining the value to the user.
- Call
loginwhen the user signs in. - Send test pushes on Android and iOS.
Install
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.
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
.p8key, Key ID, Team ID, Bundle ID, and environment in Sendrealm. - Test on a physical iOS device.
AppDelegate.swift:
UNUserNotificationCenter.current().delegate after Sendrealm is configured, forward notification responses from that delegate so open and action events are tracked:
Initialize
Initialize once near app startup: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
Link A Signed-In User
logout when the user signs out:
Tags
Use tags for app-observed preferences, state, and behavior:Custom Events
Track app events for segmentation, analytics, or automations:Notification Opens
Listen for notification opens when your app needs to route the user:Android Notification Channels
Create Android notification channels when your app needs explicit sound, vibration, or importance behavior:Diagnostics
Collect support-safe diagnostics during setup:- A device ID.
- Token presence.
- Expected permission status.
- Subscribed state unless the user opted out.
- SDK version.
- No unexpected SDK error.
Troubleshooting
| Symptom | What to check |
|---|---|
| Expo Go fails to load the package | Use a development build or bare app because native code is required. |
| Android token is missing | Use a Google Play device or emulator and verify Firebase package name setup. |
| iOS push does not arrive | Use a physical device and verify APNs environment, Bundle ID, Team ID, Key ID, and .p8 key in Sendrealm. |
| iOS entitlement is missing | Enable Push Notifications in Apple Developer and on the Xcode app target. |
| Notifications are delayed | Check Android power management, FCM priority, iOS APNs priority, Focus settings, and notification permissions. |
| Some pushes are missing | Check stale tokens, disabled channels, offline devices, and provider diagnostics. |
Tags return ContactNotLinked | Call login(userId, email) before tags. |
| Notification opens app but not the expected screen | Check the notification launch URL and your app’s deep link configuration. |