Skip to content

Fix TRC bolus command not received by Trio#589

Open
rafaeldelrey wants to merge 1 commit intoloopandlearn:devfrom
rafaeldelrey:fix/trc-background-push
Open

Fix TRC bolus command not received by Trio#589
rafaeldelrey wants to merge 1 commit intoloopandlearn:devfrom
rafaeldelrey:fix/trc-background-push

Conversation

@rafaeldelrey
Copy link
Copy Markdown

@rafaeldelrey rafaeldelrey commented Apr 5, 2026

Summary

  • Switch TRC push notifications from apns-push-type: alert (priority 10) to apns-push-type: background (priority 5)
  • Remove alert and interruption-level fields from the APNS payload

Problem

Remote bolus commands sent via Trio Remote Control appeared to succeed (APNS returned 200) but Trio never received or acted on them. Trio's logs showed no trace of an incoming push notification.

The root cause: when apns-push-type: alert is used, iOS silently drops the notification if the receiving app (Trio) has not been granted notification permissions by the user. The command never reached AppDelegate.didReceiveRemoteNotification.

Fix

Background push notifications (content-available: 1, apns-push-type: background, priority 5) are delivered by iOS regardless of notification permission status, which is the correct mechanism for remote command delivery. This matches Apple's documentation requirements — priority 5 is mandatory when using apns-push-type: background.

Test plan

  • Send a remote bolus from LoopFollow (TRC) to a Trio device that has notification permissions denied
  • Confirm Trio receives and processes the command
  • Confirm APNS still returns 200
  • Verify other TRC commands (temp target, meal, override) also work

Switch TRC push notifications from alert to background type.
Alert-type pushes are silently dropped by iOS when Trio has not
been granted notification permissions. Background push with
content-available: 1 and priority 5 is delivered regardless,
which is the correct mechanism for remote command delivery.
init(encryptedData: String, commandType _: TRCCommandType) {
self.encryptedData = encryptedData
aps = APSPayload(alert: "Remote Command: \(commandType.displayName)")
aps = APSPayload()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This article says background notifications should not contain alert: developer.apple.com/documentation/usernotifications/pushing-background-updates-to-your-app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant