I’m currently developing a React Native application and using Firebase Cloud Messaging (FCM) to handle notifications. The notifications work perfectly when the app is in the foreground. However, when the app is in the background, notifications are received, but the data payload is not being delivered to the app.
Environment
React Native Version: 0.73.6
Firebase Version: 20.3.0 (app), 20.3.0 (messaging)
@notifee/react-native Version: 7.8.2
Testing on Real Device: Yes
Issue Details
Foreground Notifications: Working as expected, receiving both notification and data payloads.
Background Notifications: Notifications are received, but the data payload is not being delivered or handled by the app.
Steps Taken
AppDelegate Configuration: Configured as per the official documentation for handling notifications.
Permissions and Background Modes: Enabled background modes and configured permissions as required.
Testing: Verified on a real iOS device.
Despite these steps, the data payload is not being delivered in the background. Any guidance or solutions to resolve this issue would be greatly appreciated.
I have tried the following steps:
Configured AppDelegate.m as per the official Firebase and React Native documentation.
Structured FCM payloads correctly for both foreground and background notifications.
Enabled the necessary permissions and background modes in Xcode.
Tested the app on a real iOS device to ensure proper behavior.
What were you expecting to happen?
I expected that the notifications received in the background would deliver the data payload to the app, allowing it to handle the data as intended.
What actually resulted?
While the notifications are received in the background, the data payload is not being delivered or handled by the app. As a result, the app does not process the data sent with the notification when it is in the background.