** Track your campaigns:** The SDK automatically tracks delivery, opens, and clicks. For advanced tracking customization and implementation details, see Push Notification Tracking.
Prerequisites
Before implementing push notifications:- Configure push credentials in Zixflow dashboard - Add APNs certificates or FCM Server Key
- Complete iOS/Android native setup - Ensure native dependencies are installed
- Device tokens must be associated with users - Call
identify()before sending notifications
Platform-Specific Requirements
iOS Requirements
- APNs or FCM: Choose either Apple Push Notification service or Firebase Cloud Messaging
- Xcode Capabilities: Push Notifications and Background Modes
- Notification Service Extension: Required for rich push (images, videos)
- Physical Device: iOS Simulator cannot receive push notifications
Android Requirements
- Firebase Project: Required for FCM integration
- google-services.json: Must be in
android/app/directory - Minimum API Level 24: Android 7.0 or higher
- POST_NOTIFICATIONS Permission: Required for Android 13+ (API 33+)
iOS Setup
You can use either APNs (Apple Push Notification service) or FCM (Firebase Cloud Messaging) on iOS.Step 1: Enable Push Capabilities in Xcode
- Open your project’s
.xcworkspacefile in Xcode - Select your app target
- Go to Signing & Capabilities tab
- Click + Capability → Add Push Notifications
- Click + Capability → Add Background Modes
- Enable Remote notifications under Background Modes
Step 2: Choose APNs or FCM
Option A: APNs (Recommended for iOS-only apps) Update yourios/Podfile:
ios/Podfile with static linkage:
Step 3: Configure AppDelegate (Swift - Recommended)
For modern Swift-based React Native apps with APNs: AppDelegate.swift:ZixflowMessagingPushFCM instead:
Step 4: Configure AppDelegate (Objective-C)
If your React Native app uses Objective-C, create a Swift bridge: CreateMyAppPushNotificationsHandler.swift:
AppDelegate.mm:
Step 5: Rich Push with Notification Service Extension
To support rich push notifications (images, videos, GIFs), add a Notification Service Extension: 1. Create Notification Service Extension:- In Xcode: File → New → Target
- Select Notification Service Extension
- Name it
NotificationServiceExtension - Click Finish (activate scheme when prompted)
ios/Podfile to include the extension:
NotificationService.swift:
"YOUR_API_KEY" with your actual API key.
Android Setup
Android push notifications use Firebase Cloud Messaging (FCM).Step 1: Add Firebase to Your Project
- Go to Firebase Console
- Add your Android app to Firebase project
- Download
google-services.json - Place
google-services.jsoninandroid/app/directory
Step 2: Configure Gradle
Project-levelandroid/build.gradle:
android/app/build.gradle:
Step 3: Add Permissions
Add toandroid/app/src/main/AndroidManifest.xml:
Step 4: Configure Notification Icon and Color (Optional)
Add toandroid/app/src/main/AndroidManifest.xml inside <application> tag:
React Native Integration
Step 1: Initialize SDK
Initialize the Zixflow SDK in yourApp.tsx:
Step 2: Request Push Permission
Request permission to send push notifications:| Option | Type | Description |
|---|---|---|
sound | boolean | Enable notification sounds |
badge | boolean | Enable app badge updates |
alert | boolean | Show notification alerts |
Step 3: Check Permission Status
Check current push permission status:Step 4: Identify Users
Critical: Device tokens must be associated with a user before push notifications can be delivered.- When users start the app, they automatically generate a device token
- This token links to their Zixflow profile when you call
identify() - This ensures notifications are delivered to the correct user
Step 5: Get Device Token
Retrieve the registered device token:Deep Links and Navigation
Handle deep links from push notifications:Setup Deep Linking
1. Configure Deep Links (iOS): Add toios/YourApp/Info.plist:
android/app/src/main/AndroidManifest.xml:
Handle Deep Links in React Native
Use React Navigation’s linking configuration:Rich Push Notification Payloads
The Zixflow SDK automatically handles rich push notifications. Here’s how to structure payloads:iOS APNs Payload
iOS FCM Payload
Android FCM Payload
Testing Push Notifications
1. Verify Device Token Registration
Check if device token is registered:2. Enable Debug Logging
Set log level to debug during development:3. Test on Physical Devices
iOS:- Push notifications do not work on iOS Simulator
- Must use physical iOS device
- Ensure APNs certificate is configured in Zixflow dashboard
- Emulator works if Google Play Services installed
- Physical device always recommended
- Ensure FCM Server Key is configured in Zixflow dashboard
4. Send Test Push from Zixflow
- Log into Zixflow dashboard
- Navigate to Messaging → Push Notifications
- Create test push notification
- Send to specific user (using
userIdfromidentify())
Troubleshooting
iOS Push Not Received
Symptoms: Push sent but not delivered on iOS Solutions:- Verify Push Notifications capability enabled in Xcode
- Check APNs certificate uploaded to Zixflow dashboard
- Ensure testing on physical device (not simulator)
- Verify user identified:
Zixflow.identify({ userId: ... }) - Check permission granted:
getPushPermissionStatus() - Review logs for errors
Android Push Not Received
Symptoms: Push sent but not delivered on Android Solutions:- Verify
google-services.jsoninandroid/app/directory - Check FCM Server Key in Zixflow dashboard
- Ensure POST_NOTIFICATIONS permission granted (Android 13+)
- Verify Google Services plugin applied
- Check device token registered
- Review logs for errors
Rich Push Not Working (Images)
Symptoms: Images not loading in notifications iOS Solutions:- Ensure Notification Service Extension properly configured
- Verify extension has correct dependencies in Podfile
- Check App Groups configuration (if using)
- Verify image URL is accessible
- Check extension logs for errors
- Verify image URL is accessible from device
- Check internet connectivity
- Ensure image format is supported (JPEG, PNG, GIF)
Permission Denied
Symptoms: User denied push permission Solutions:- Explain value before requesting permission
- Guide users to Settings to enable manually
- Show in-app message explaining benefits
- Request permission at appropriate time (after user engagement)
Device Token Not Registered
Symptoms:getRegisteredDeviceToken() returns empty or fails
Solutions:
- Verify SDK initialized before calling
- Check permission granted
- Ensure identify() called to associate token
- Review native logs for errors
- Rebuild app and retry
Best Practices
- Request permission thoughtfully - Explain value before asking
- Identify users immediately after authentication
- Test on physical devices - Simulators have limitations
- Use rich push - Images increase engagement
- Handle deep links - Provide seamless navigation
- Monitor metrics - Track delivery and open rates
- Enable debug logging - During development only
- Test both platforms - iOS and Android behave differently
- Clear identity on logout - Call
clearIdentify() - Keep credentials secure - Never commit API keys to git