We have an issue with push notifications sent to a topic from our server. Actually, it isn't the sending part, it is the receiving. That push notifications are received by some iOS devices but not all. We haven't had issues with Android devices, we had one report regarding Android but I think that's a hoax.
Technical details
We build a request in PHP:
$topic = '/topics/urgent_de';
$data = [
'to' => $topic,
'priority' => 'normal',
'notification' => [
'title' => $pushNotification->title_de,
'body' => $pushNotification->text_de,
'topic' => 'urgent',
'target' => $pushNotification->deeplink
],
'data' => [
'title' => $pushNotification->title_de,
'message' => $pushNotification->text_de,
'topic' => 'urgent',
'target' => $pushNotification->deeplink
]
];
Devices register on this topic using:
let sub:SupportedLanguage = UrlHelper.getBestSupportedLanguage() == .de ? .de : .en
static let topicUrgent = "/topics/urgent"
static let topicUrgentLocalizedPrefix = "urgent_"
let localizedUrgent = "\(Constants.Push.topicUrgentLocalizedPrefix)\(sub.rawValue)"
Messaging.messaging().subscribe(toTopic: localizedUrgent)
LoggingHelper.info("Subscribed to topic: \(localizedUrgent)")
Messaging.messaging().subscribe(toTopic: Constants.Push.topicUrgent)
LoggingHelper.info("Subscribed to topic: \(Constants.Push.topicUrgent)")
This means, each device subscribes not only to a localized but also a general topic.
Problem description
We sent out a few pushes within two weeks last September and some devices in our company received them, some didn't. It didn't depend on their app or iOS version. They all have given permission to receive pushes. They were all online and running when we sent that push. None of the devices had our app in foreground. Some haven't started the app for a few weeks some had them open that same day.
What we already tried
- We tried priority high
- We tried to find out how many users are affected. But reports in firebase console don't seem to include iOS devices or firebase can't track if a push was received by iOS devices (when setting filter "platform/channel" to "iOS" or "app" to "iOS app", received number is "0" but sent to several thousand)
- We put an iOS device which didn't receive one push on our development Macbook
- We tried to check logs but (of course) there was not output
- Then we deployed from XCode and sent a push to that device's token but it was received => We couldn't reproduce the issue.
- We then uninstalled the development version and installed app from app store.
- The following push was received
- We sent another push to topic a few months later. It wasn't received.
- I searched stackoverflow and other resources but I didn't find this specific issue (usually it is a problem where no pushes are received or similar)
All in all, when we look at all devices in our company, only half of them receive those push notifications.