Push notifications look simple from the outside: send a message, it shows up on a phone. The architecture behind a notification that actually arrives, on time, without leaking information it should not carry, is a lot more involved. This article walks through how push delivery actually works on iOS and Android, where most implementations lose messages or break under load, and what changes when the notification touches patient or health data. If you are planning a mobile app with any kind of real-time alerting (appointment reminders, order updates, chat messages, monitoring alerts) this is the groundwork to get right before you write a line of client code.
What Push Notifications Actually Require From Your Backend
A push notification never travels directly from your server to a device. Both major platforms sit a vendor-operated gateway in the middle:
- Apple Push Notification service (APNs) for iOS, iPadOS, macOS, and watchOS.
- Firebase Cloud Messaging (FCM) for Android, and commonly used as a wrapper for iOS delivery too.
Your backend builds a payload, authenticates to the gateway, and hands the message off. From that point, delivery is the gateway's responsibility, not yours. That handoff is where most of the design decisions live: how you authenticate, what you put in the payload, how you track whether delivery actually happened, and what you do when a device is unreachable.
For a cross-platform app, the common pattern is to use FCM for Android and either FCM or direct APNs calls for iOS. Using FCM for both reduces the number of integrations your backend maintains, since you send to a single API and FCM handles routing to APNs on iOS's behalf. Calling APNs directly gives you lower-level control over payload fields and delivery priority, at the cost of maintaining two code paths.
Data Messages vs. Notification Messages
This distinction causes more production bugs than anything else in push design. FCM and APNs both support two payload shapes:
- Notification (display) messages: the OS renders these automatically, even if your app is closed or in the background. You cannot run code before it displays.
- Data (silent) messages: delivered to your app code, with no automatic UI. Your app decides whether to show something, update local state, or do nothing.
Firebase's own documentation on FCM message types makes the split explicit: notification messages are handled by the FCM SDK automatically, while data messages are handled entirely by the client app. The practical implication is that a notification message is wrong for anything that needs a decision made first, such as checking whether the content is still relevant or whether the user has muted that category. For those cases, send a data message, let the app fetch current state, and raise a local notification only if it still makes sense.
On iOS, background data delivery is also constrained. The OS limits how much background execution time your app gets and can throttle or defer delivery if the device is managing battery or data conditions, so silent push is a hint, not a guarantee. Design for "usually arrives quickly," not "always arrives instantly."
Device Tokens Are a Lifecycle, Not a Field
A device token is not permanent. It rotates when the app is reinstalled, when the user restores a backup to a new device, after OS updates in some cases, and periodically for security reasons on both platforms. Treat tokens as a managed resource with a real lifecycle:
- Store tokens mapped to a user, not just a device, since one user can have multiple active devices.
- Record the platform and app version with each token, since payload format and size limits differ.
- Refresh the token on every app launch and overwrite the stored value, rather than trusting a token captured once at install.
- Remove tokens that bounce back as invalid. Both APNs and FCM report uninstalled apps and expired tokens; failing to prune them wastes send volume and inflates delivery metrics with guaranteed failures.
Teams that skip this usually find out the hard way: notification volume climbs for months while actual delivery rates quietly drop, because a growing share of sends target tokens that stopped being valid weeks earlier.
Designing for Reliability at Scale
Once you are sending more than a handful of notifications per event, naive synchronous sending (loop over users, call the API, wait) becomes the bottleneck. A few patterns matter once volume grows:
- Decouple triggering from sending. Put the "a notification should go out" event on a queue, and let a separate worker pool handle fan-out. This keeps a slow push gateway from blocking the part of your system that detected the event.
- Retry with backoff, then stop. Transient gateway errors deserve a retry. A token that comes back as permanently invalid does not; retrying it forever just adds noise. Route permanent failures to a dead-letter path for cleanup, not an infinite retry loop.
- Respect payload size limits. Apple's current documentation on generating a remote notification sets the maximum payload at 4 KB for standard notifications and 5 KB for VoIP notifications; FCM enforces a similar 4096-byte limit. Keep the visible payload small and fetch detail from your API after the app opens, rather than trying to cram context into the push itself.
- Treat "accepted by the gateway" as separate from "seen by the user." APNs and FCM confirm that they accepted your request, not that the notification displayed. If you need confirmation of actual delivery or read status, that has to come back from the client app as its own event.
Permissions and Frequency: The UX Half of Reliability
A technically perfect push system still fails if users deny permission or mute the app after being overwhelmed. A few decisions have an outsized effect on long-term delivery rates:
- Ask for notification permission after the user has seen a specific reason for it (an appointment was booked, a conversation started), not on first app launch before there is any context.
- Use notification categories or channels (Android notification channels, iOS notification categories) so users can mute low-value alerts without disabling notifications entirely.
- Cap frequency per category. A single over-eager alert type is usually what causes a user to disable all notifications, not an occasional reminder.
- Make the stated purpose match the actual behavior. If you describe the permission request as being for appointment reminders, do not later use the same channel for marketing messages; that mismatch drives opt-outs and, in regulated contexts, can create its own compliance problem.
Keeping PHI Out of the Notification Payload
If your app serves patients, providers, or any healthcare workflow, the push payload needs a different standard than a typical consumer app. A locked-screen notification is visible to anyone who can see the phone, which means it is effectively a public disclosure channel. The safer architecture is to keep the visible content generic and treat the notification purely as a trigger to open the app and authenticate:
- Avoid patient names, provider names, diagnosis terms, appointment specifics, or medication names in the visible title or body.
- Use neutral phrasing: "You have a new message" or "Your results are ready, sign in to view them" rather than anything that names a condition, a provider, or a clinic.
- Prefer a data message that triggers an authenticated fetch over a display message that shows content directly, when the underlying information is protected health information.
- Remember that even a generic-sounding message can disclose something if the sender identity itself reveals the relationship, for example a notification clearly branded to a specific specialty clinic.
It is also worth being precise about what "HIPAA compliant push notifications" means in practice: neither APNs nor FCM is HIPAA compliant by default, because Apple and Google do not sign Business Associate Agreements for these services in the way a covered entity or business associate would need for a system that transmits PHI. That does not mean push is off the table for healthcare apps. It means the payload itself should not carry PHI, and any PHI the user ultimately sees should be rendered inside the app, over an authenticated, encrypted connection, after the notification has done its job of prompting the user to open the app. Whether a specific implementation satisfies HIPAA's Security Rule also depends on your broader risk analysis, access controls, and administrative safeguards, not on the push mechanism alone. For a fuller picture of what the Security Rule expects at the infrastructure and process level, see our HIPAA security and compliance overview. This is general technical guidance, not legal advice; confirm your specific obligations with qualified counsel or a compliance advisor, and HHS's Office for Civil Rights publishes guidance for health app developers that is worth reviewing directly.
Testing and Monitoring Push Delivery
Push failures are quiet by default: nothing in your app crashes, the API call that triggered the send usually returns success, and the user simply never sees anything. Build visibility in deliberately:
- Log every send attempt with the token, platform, and gateway response, not just successes.
- Track invalid-token and uninstall feedback from both gateways and feed it back into your token store automatically.
- Test the scenarios that are easy to skip: app killed by the OS, device offline at send time then reconnecting later, notification permission revoked mid-session, and token rotation happening between send and delivery.
- Set an alert on delivery rate, not just send volume. A silent drop in delivery rate is the signal that something in token hygiene or payload formatting broke.
Frequently Asked Questions
Should I build push notifications myself or use a third-party provider?
For straightforward transactional alerts, a managed provider can save development time by handling fan-out, retries, and basic analytics. For healthcare apps or anything with specific payload and audit requirements, review the provider's data handling closely, since the provider sits in the delivery path and may need its own Business Associate Agreement if PHI is ever involved, even indirectly.
Can a data-only push wake up my app reliably on iOS?
It can, but not guaranteed instantly every time. iOS manages background execution based on battery state, network conditions, and how often the user opens the app, so silent push should be treated as "usually prompt," not a real-time guarantee for time-critical actions.
Do I need separate logic for Android notification channels and iOS categories?
Yes. They are conceptually similar (both let a user control specific notification types independently) but configured differently at the platform level. Plan your notification taxonomy once, then implement the platform-specific mapping on each side.
Is it safe to put a patient's first name in a push notification?
Treat it as risky by default. A name combined with any healthcare context, even an app's branding, can amount to a disclosure of protected health information on a locked screen. Keep the visible payload generic and let the authenticated app screen show personalized detail.
How do I handle notifications for a user with multiple devices?
Store tokens per device, linked to the user, and decide deliberately whether an event should notify every registered device or just the most recently active one. Sending to every device by default often creates duplicate, confusing alerts for multi-device users.
Getting push notification architecture right is mostly about making a small number of decisions early (payload type, token lifecycle, what PHI exposure risk looks like for your app) rather than fixing them after users start complaining about missed or duplicate alerts. If you are scoping a new mobile app, a offline-first mobile architecture and a Flutter vs React Native comparison are useful companion reads, since both decisions interact directly with how reliably push and background sync behave in practice.
Sabyrix builds mobile apps, including for healthcare and telemedicine products, where this kind of architecture decision gets made during discovery, not after launch. If you are planning a new app or auditing an existing one, our mobile app development services page covers how we approach this, and you can book a strategy call to talk through your specific requirements, including for telemedicine platform development.