I need a way to receive a silent push notification, and then display a local one (so I can process data before displaying to user)
Is there a way to do this?
didReceiveNotification
is only called when in the foreground.
I believe the app is launched when in background upon receiving push. However, there does not seem to be a solution for when the app is killed.
EDIT I am aware of PushKit but my app is not a VOIP app, it is an IM app.
Silent notifications are not meant as a way to keep your app awake in the background beyond quick refresh operations, nor are they meant for high priority updates.
The system makes every attempt to deliver local and remote notifications in a timely manner, but delivery isn't guaranteed. The PushKit framework offers a more timely delivery mechanism for specific types of notifications, such as those VoIP and watchOS complications use. For more information, see PushKit.
Silent push notifications are simply notifications that mobile app users receive without any pings, alerts, or interruptions to the user. They arrive on the mobile device and sit in the notification tray until read or dismissed.
Push notifications are small, pop-up messages sent to a user's device by a mobile app that appear even when the app isn't open. These notifications are designed to grab attention and can convey reminders, updates, promotions, and more. Push notifications can consist of a title, a message, an image, and a URL.
You can use the UIApplicationDelegate
method didReceiveRemoteNotification:
to receive a 'silent' push when your app is in the foreground or background, but If your app is killed (force-quit from the switcher) then there is no way to receive the notification in your app. The notification payload (if any) will still be displayed to the user, giving them the opportunity to launch your app from the notification.
The documentation for this delegate method states:
In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a remote notification arrives. However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With