Silent Push Notifications Only Delivered If Device Is Charging And/Or App Is Foreground

Silent push notification not working on foreground iOS app

Well, after struggling with this for days I stumbled upon my answer barely an hour after posting this question.

To get background notifications delivered to your app you must call UIApplication.shared.registerForRemoteNotifications() every time your app is launched. I was skipping the call if I already had the token and this was causing my delegate method to not be called.

iOS Silent Push notifications are failing with message

It is working now, I was using api.sandbox.push.apple.com:443 which is mentioned in https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/

when I switched to api.development.push.apple.com:443, it works fine

Firebase iOS silent push notification stop to be delivered in background (after a while)

Sounds to me like you've got your app configured correctly for FIRMessaging(), but not for APNs.

Here's the thing: Firebase Messaging is only used for sending data-only messages when your app is in the foreground. By definition, it doesn't work when your app is in the background -- if you're trying to send messages to your app in the background, Firebase Cloud Messaging routes your message through APNs, which is received through normal APNs-y methods, like application(_:didReceiveRemoteNotification:fetchCompletionHandler:).

If you want more information on this topic, maybe I humbly suggest the Debugging Firebase Cloud Messaging on iOS post on the Firebase blog.



Related Topics



Leave a reply



Submit