Reputation: 1632
I am developing an iOS chat app using react-native. Enabled remote notification capability. Notifications are received when the app is connected with network. Once I switched off the mobile and switching it on after a night, the pending notifications are not received. Any idea of why it is not receiving?
My notification payload will looks like,
pn_apns: {
aps: {
alert: {"title": "test", body: "hello"},
sound: "default",
content-available: 1
}
}
Upvotes: 4
Views: 459
Reputation: 416
The key is to send apns-expiration from the provider server while sending the notification to the APNs.According to the documentation the apns-expiration is the UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded.If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.The default value of the apns-expiration is zero
Upvotes: 1