Not receiving push sent when device was offline

Hi,

we noticed some issues with our app when it comes to receiving pushs sent when a device was offline. We know that only one push is stored if multiple are received while the device was offline but we got reports of multiple users that aren't receiving any pushs that were sent while they were offline. Reinstalling the App didn't help.

We ruled out the third-party providers we used as my first thought was that there was some issues with setting the expiry but it also happens if directly sent over APNs.

With a development build and the sandbox APNs I had no issue receiving one push after getting back online. But after reinstalling the production app no push after being offline.

Example sent with the Push Notifications Console but I also tested it with curl directly:

curl -v \
  --header "authorization: bearer ${AUTHENTICATION_TOKEN}" \
  --header "apns-topic: de.alarm-it-factory.ACC-App-Xamarin" \
  --header "apns-push-type: alert" \
  --header "apns-priority: 10" \
  --header "apns-expiration: 1721379960" \
  --data '{"aps":{"alert":{"title":"Test","body":"Expiry Test 4"}}}' \
  --http2  https://api.push.apple.com:443/3/device/46F201D299F2B900CF3BF3096341116B9D5A69D103F2C0ACF18634823F73AB79
  • Sent: 15. Juli 2024, 16:00:42,361 MESZ
  • Received: not received
  • Topic: de.alarm-it-factory.ACC-App-Xamarin
  • BundleID: de.alarm-it-factory.ACC-App-Xamarin
  • Token: 46F201D299F2B900CF3BF3096341116B9D5A69D103F2C0ACF18634823F73AB79
  • apns-id: ec14fba2-efa5-4ace-9e22-3e4e5a64d630

I sent test messages before and after acivating airplane mode to make sure I have the correct token.

Answered by Engineer in 795403022

I believe the issue is you have previous tokens you have assigned for this device/app combination, and you are also sending notifications to those tokens, which are not being sent to the device, but are still overwriting the previous notification being held in the queue of one, for that specific app on the specific device.

In the 2 hours around the time of your reported failed notification above, you have also been sending notifications to (possibly) old tokens for the same device: E06E81DDA4703F0A100B7DBE91E68A3F6ADAEE2F3CDA4B05FC1BC8813FD7C825 667FCD43E6705C348A237640204D69022F783A435936BD222FD665D49F92718F

But after reinstalling the production app no push after being offline.

Possibly can be explained with this finding. After reinstalling the app, you are getting a new token, but are not deleting the old token from your database, which ends up getting notifications sent to the old token which is overwriting the queue and losing the notification to the new token if the device is offline at the time.

So, the solution to this will be to maintain your token database more carefully.

Accepted Answer

I believe the issue is you have previous tokens you have assigned for this device/app combination, and you are also sending notifications to those tokens, which are not being sent to the device, but are still overwriting the previous notification being held in the queue of one, for that specific app on the specific device.

In the 2 hours around the time of your reported failed notification above, you have also been sending notifications to (possibly) old tokens for the same device: E06E81DDA4703F0A100B7DBE91E68A3F6ADAEE2F3CDA4B05FC1BC8813FD7C825 667FCD43E6705C348A237640204D69022F783A435936BD222FD665D49F92718F

But after reinstalling the production app no push after being offline.

Possibly can be explained with this finding. After reinstalling the app, you are getting a new token, but are not deleting the old token from your database, which ends up getting notifications sent to the old token which is overwriting the queue and losing the notification to the new token if the device is offline at the time.

So, the solution to this will be to maintain your token database more carefully.

Not receiving push sent when device was offline
 
 
Q