Hello all.
I've been asked to add data push notifications to an iOS app, and that is working good.
It must be a data push as my banner must show user icon, not app icon (like WhatsApp and Telegram).
So the notification banner is showing, until the app is opened or it's been closed less than 2 days (more or less) ago.
After (about) 2 days, the push banner is not displayed anymore.
Did never had this problem when I was using "normal" notifications.
BTW, the banner is displayed as I open the app.
Any thoughts?
"Remote notifications" background mode is already activated.
I'm using Firebase Cloud Messaging, if it can help. application:didReceiveRemoteNotification:fetchCompletionHandler is implemented.
Push msg has
"aps": {
"content-available": 1
},
in the correct place.
Thank you
The behavior you are seeing is expected, and it is due to content-available (aka "background" or "silent") push notifications being throttled when being delivered to apps that are in the background.
Background push notifications are never guaranteed to be delivered to the app every single time. Although you may expect up to several background push notifications per hour across all apps on a device, it is entirely possible and appropriate that you may receive none at all. Additionally, these notifications will not be delivered to the app at all if the user has not launched the app for a while.
Also, an app will not be woken in the background by a push notification if the app had previously been force-quit. Force quit is considered a drastic choice by the user to say that they do not want the app to run, often because it misbehaved in some unrecoverable manner.
If I understand your use case correctly, you are trying to change the contents of the notification to display a different icon. The recommended way to do this is using a Notification Service Extension as discussed at https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension. The Notification Service Extension will be executed for every visible push notification. So, it could serve your needs, as long as the user has not disabled the visibility of your notifications through various settings.