regards documentation of Firebase I have (I suppose) collapsible message.
I had a similar problem with Android, but after removing the whole notification
object from the payload it started working.
But on iOS sending notification with (only) data as payload nothing helped – only last notification appears after switching network from offline to online.
Honestly, I tried many different ways (with or without apns header, without apns etc.) and I see a dead end. Help!
For now, my payload looks:
message: {
token: 'some token',
data: {
title: 'some title',
body: 'some body',
content_available: 'true',
priority: 'high'
}
}
And I’m sending using Rest API
I’m using:
System:
OS: macOS 12.7.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 3.49 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.1/bin/yarn
npm: 9.8.1 - ~/.nvm/versions/node/v16.17.1/bin/npm
Watchman: 2024.01.22.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.15.2 - /Users/darek/.rvm/gems/ruby-2.6.5/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10671973
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.21 - /usr/local/opt/openjdk@11/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.17 => 0.71.17
react-native-macos: Not Found
"@notifee/react-native": "7.8.0",
and
"@react-native-firebase/analytics": "19.2.2",
"@react-native-firebase/app": "19.2.2",
"@react-native-firebase/messaging": "19.2.2",
(also tried 18.8.0, 18.9.0)
2
Answers
Having tried many options to fix the above. Especially, when encountering issues with sending push notifications via Firebase to iOS devices.
First thing you might need to troubleshoot is to ensure that your Firebase project settings are correct, particularly the APNs authentication key or certificate for iOS push notifications.
Regarding your payload, it looks mostly correct, but there are a few points to clarify:
quotes) rather than ‘true’.
should be delivered immediately. However, since you’re using
data-only notifications, the priority may not be affecting your case
directly. Still, it’s good practice to set it correctly.
to the app. This should work fine, but remember that on iOS,
data-only notifications may not display anything to the user if the app is in the background or terminated. You’ll need to
handle the incoming data and decide how to display it within your
app.
Given your setup, here’s a revised payload example:
If you’re still facing issues after ensuring the above points, you will need to look deeper into the specifics of your iOS setup:
If you covered all these aspects and the issue persists, it might be beneficial to provide more details about how you’re handling notifications in your iOS app and any error messages you’re encountering. This will help in diagnosing the problem more accurately.
The behaviour you are describing for iOS is expected.
If a device is offline, APNS may coalesce messages for an app and only deliver the most recent:
Push notifications on iOS do not provide guaranteed delivery. They should not be considered as an alternative to your app fetching data from a server. A silent push notification can be used as a trigger to tell your app to fetch data from the server.