APNS not sending push notificatoin where expiration is specified and device isn't online

I have a apns request where i specify expiration of 5 min. When the notification is raised device isn't online, and after getting device online after 2 min, i still don't get a notification. Ideally if i do get the device online after 5 min and not receive notification that's expected. If i remove the expiration all together and then do same steps as above, i always receive the notification. Here's a curl request i am making:

curl -v -d '{"aps":{"alert":{"title":"Device Status","body":"some body"}, "badge":0}}' -H "apns-topic: com.app.app" -H "apns-priority:10" -H "apns-expiration:300" -H "authorization: bearer Token" --http2 https://api.development.push.apple.com/3/device/deviceId

Any suggestion why this is happening when expiration is specified and any work around for achieving this

Accepted Answer

apns-expiration:300 means the notification expires at 5 minutes past midnight on 1/1/1970 UTC

The value you need to use is the Unix Time in seconds for when you want the notification to expire.

APNS not sending push notificatoin where expiration is specified and device isn't online
 
 
Q