React Native’s cross-platform nature allows unified push notification handling, but platform-specific configuration and certificates are still required.
Prerequisites
Before implementing push notifications, ensure you have:Firebase Project
Active Firebase project with FCM enabled for both platforms
Platform Certificates
Android FCM service account JSON and iOS APNs .p12 certificate
social.plus SDK
social.plus TypeScript SDK properly integrated
Development Setup
React Native development environment configured for both platforms
Step 1: Install Dependencies
Core Firebase Dependencies
Always use the latest stable versions. Check the React Native Firebase documentation for current compatibility.
Additional Utility Libraries
Step 2: Platform Configuration
Android Configuration
-
Add google-services.json to
android/app/
- Update build.gradle files:
- Add permissions to AndroidManifest.xml:
iOS Configuration
- Add GoogleService-Info.plist to iOS project in Xcode
-
Enable Push Notifications capability in Xcode:
- Select your target → Signing & Capabilities → + Capability → Push Notifications
- Update AppDelegate for Firebase:
- Update Info.plist for background modes:
Step 3: Upload Certificates to social.plus Console
Android - FCM Service Account
-
Generate FCM service account JSON:
- Go to Firebase Console → Project Settings → Service Accounts
- Click “Generate new private key”
- Download the JSON file
-
Upload to social.plus Console:
- Navigate to Settings → Push Notifications
- Upload the FCM service account JSON file
iOS - APNs Certificate
- Generate .p12 certificate following the iOS setup guide
- Upload to social.plus Console:
- Navigate to Settings → Push Notifications
- Upload the .p12 file with password
Refer to the iOS Push Notification Certificate Setup Guide for detailed certificate generation instructions.
Best Practices
Cross-Platform Considerations
Cross-Platform Considerations
Platform-Specific Handling: While React Native allows code sharing, handle platform differences appropriately.
Permission Management
Permission Management
Strategic Permission Requests: Request permissions at meaningful moments, not app launch.
State Management
State Management
Token State Synchronization: Keep token state consistent across app lifecycle and updates.
Error Handling
Error Handling
Robust Error Management: Implement comprehensive error handling for various failure scenarios.
Testing Strategies
Firebase Console Testing
-
Use Firebase Console to send test messages:
- Go to Firebase Console → Cloud Messaging → Send Test Message
- Use the FCM token from your debug component
- Test different message types and data payloads
-
Test Both Platforms:
- iOS: Test with TestFlight builds (debug builds don’t receive push notifications)
- Android: Test with both debug and release builds
Troubleshooting
Common Issues
Common Issues
Token Not Generated:
- Firebase Configuration: Verify
google-services.json
(Android) andGoogleService-Info.plist
(iOS) are correctly placed - Permissions: Ensure notification permissions are granted
- Network Connectivity: Check internet connection
- APNs Token (iOS): Verify APNs token is available before requesting FCM token
Platform-Specific Issues
Platform-Specific Issues
iOS Specific:
- Push notifications don’t work in iOS Simulator
- Debug builds can’t receive push notifications
- Requires valid APNs certificate uploaded to social.plus Console
- Android 13+ requires runtime notification permission
- Verify FCM service account JSON is uploaded to console
- Check that
google-services.json
matches your package name
Related Resources
React Native Firebase
Official React Native Firebase documentation
iOS Certificate Setup
Detailed iOS APNs certificate generation guide
Android FCM Setup
Android Firebase Cloud Messaging configuration
Testing Requirements: iOS push notifications require TestFlight or App Store builds. Android notifications work in both debug and release builds, but release builds are recommended for production testing.