Background Push Notifications for Emergency App Delayed Despite Critical Alert Entitlement

I’m using Appnotic from my server to send notifications for an emergency service, where it is critical that notifications are delivered immediately.

My payload looks like this:

  "aps": {
    "alert": "Test alert",
    "sound": {
      "critical": 1,
      "name": "sound.wav",
      "volume": 0.5
    },
    "content-available": 1,
    "category": "alert"
  },
  "topic": "com.fireservicerota.FSR-Primary-Alerting",
  "custom_payload": {
    "id": "11",
    "type": "alert",
    "incident_id": 23434,
    "incident_response_id": 2652343,
    "expiration_time": "2024-06-06T16:59:05+01:00"
  }
}

I already have the critical alert entitlement and background processing enabled. Everything seems fine when debugging, but I’m experiencing issues: • Some notifications never arrive • Around 60% of notifications arrive with noticeable delay

Since this is an emergency app, delivery speed is crucial. What could be causing this inconsistency?

Answered by Engineer in 833976022

Critical alerts are sent at as high a priority as possible. Being critical does not make a notification immune to the usual case of notifications being delayed, the device being momentarily offline, or being on a connection unable to sustain a persistent connection to APNs.

In those cases, the notifications would be delayed, critical or not.

If you can share the apns-id of a notification that was delay, along with when it was sent and when it was received, we can check to see if we can determine the reason.

But my main suspicion is based on your saying this works fine when debugging. How are you determining that the notifications arrive and when? Using the background processing?

If so, that is not going to be reliable. The criticalness of a notification only applies to the sound and visibility of the notification. The background processing is heavily throttled, and your app may not even be notified beyond one or two notifications in an hour. Debugging will remove this throttle and will not represent what will happen in production.

If you want to process every notification that arrives, you will instead want to take a look at UNNotificationServiceExtension

This extension will be called for all visible notifications (including critical alerts). What you will need to be careful here, in your case, is this notification extension runs before the notification is presented, so if you take too long there, that will add a delay to the presentment of the notification.


Argun Tekant /  DTS Engineer / Core Technologies

Accepted Answer

Critical alerts are sent at as high a priority as possible. Being critical does not make a notification immune to the usual case of notifications being delayed, the device being momentarily offline, or being on a connection unable to sustain a persistent connection to APNs.

In those cases, the notifications would be delayed, critical or not.

If you can share the apns-id of a notification that was delay, along with when it was sent and when it was received, we can check to see if we can determine the reason.

But my main suspicion is based on your saying this works fine when debugging. How are you determining that the notifications arrive and when? Using the background processing?

If so, that is not going to be reliable. The criticalness of a notification only applies to the sound and visibility of the notification. The background processing is heavily throttled, and your app may not even be notified beyond one or two notifications in an hour. Debugging will remove this throttle and will not represent what will happen in production.

If you want to process every notification that arrives, you will instead want to take a look at UNNotificationServiceExtension

This extension will be called for all visible notifications (including critical alerts). What you will need to be careful here, in your case, is this notification extension runs before the notification is presented, so if you take too long there, that will add a delay to the presentment of the notification.


Argun Tekant /  DTS Engineer / Core Technologies

Background Push Notifications for Emergency App Delayed Despite Critical Alert Entitlement
 
 
Q