IOS Problem with data only message
See original GitHub issueThanks @evollu for this library. I have been struggling with getting push to work with FCM and ios for a while. I followed your instructions and when I was done, I could send messages from Firebase Console and I would receive them in the app. Here is my problem though, when I send the following using the FCM api, it works
{ "to": "token-here", "priority": "high", "notification": { "title": "You have a new message", "text": "The new message here" }, "data": { "customId": "<my custom id>", "badge": 0, "alert": "New data is available" } }
but when I remove the notifications property, like this
{ "to": "token-here", "priority": "high", "data": { "customId": "<my custom id>", "badge": 0, "sound": "cheering.caf", "alert": "New data is available" } }
the app does not display anything. Even the breakpoints in FCM.on(FCMEvent.Notification, async (notif) =>
are not being hit. What could I be doing wrong?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
so I am going to leave this here for any future people having the same issue.
TL;DR make sure you are using the latest Firebase Admin API for your project
I am using the Firebase admin api to send notifications from my server to the devices. data only messages were working then one day just stopped. I was researching this last night and saw the suggestion to set breakpoints in the AppDelegate.m file. Turns out notifications where never making it to my app at all unless I had the
notification
object included. When digging further into the firebase admin documentation I realized that I was using the legacy api (sendToDevice()
vssend()
) when I switched to the newer method I started seeing errors in my console that the Firebase cloud messaging api had not been enabled for this project. Luckily the error gave me a link to go to so that I could enable it. Once I followed that link (to another completely different area of google console 🙄 ) I was greeted with a great big “enable api” button. Now data only messages are working like a charm 😄@Ikiugu i spent a whole day to fix this issue, then all works when i changed the dependencies
"react-native-fcm": "^9.7.2"
to"react-native-fcm": "6.2.3"
i hope it helps you