Test notifications from the Firebase console arrive fine, but real notifications don't reach devices, or only arrive inconsistently between foreground and background states.
Handle foreground and background messages separately, confirm the device token is registered correctly, and verify platform-specific push configuration (APNs for iOS, notification channels for Android).
Step-by-Step Guide
Verify google-services.json / GoogleService-Info.plist match the correct Firebase project
Log the FCM token on device and confirm it's saved server-side
Explicitly request notification permission on iOS and Android 13+
Handle FirebaseMessaging.onMessage (foreground) and onBackgroundMessage (background) separately
Create a notification channel for Android 8+ before sending notifications
Confirm a valid APNs certificate or key is uploaded for iOS in the Firebase console
Send a test message via the Firebase console using the exact device token
Check battery optimization settings aren't killing the app in the background on some Android devices
Found an issue with this solution?