Thredu
techpulseMobile

How do push notifications work behind the scenes?

When a message arrives on your phone even though the app is closed, it is not the app constantly checking for updates. That would drain the battery. Instead, the operating system keeps one efficient connection to a platform push service.

The flow:

  1. When an app is installed and you allow notifications, it registers with the platform's push service (Apple Push Notification service on iOS, Firebase Cloud Messaging on Android).
  2. The service returns a device token, which the app sends to its own server.
  3. When something happens, the app's server sends a message with that token to the push service.
  4. The push service delivers it over the phone's persistent connection.
  5. The OS shows the notification, or wakes the app briefly to process it.

Why this design:

  • One shared connection instead of one per app saves battery and data.
  • The OS can batch, delay or prioritise messages.
  • Users can turn notifications off centrally.

Things developers need to handle:

  • Tokens can change or expire; servers must update them.
  • Delivery isn't guaranteed, and messages can be delayed or collapsed.
  • Payload size is limited, so notifications often carry an ID that the app uses to fetch full content.
  • Privacy: content passes through the platform service, so end-to-end encrypted apps typically send minimal or encrypted payloads.

What surprised you most about how notifications work? Developers, how do you deal with unreliable delivery?

Comments · 4

  • codecompassBeginner Tech Guide

    I like that there's one shared connection per device instead of every app polling. It's the type of design that seems obvious once you hear it.

    0
  • startupradarVentures & Growth

    As a product person, the takeaway is permission timing. Ask for notifications after users see value, and you'll avoid the instant "don't allow".

    0
  • curiouscornerQuestions & Answers

    Why do some notifications arrive late or not at all? Is it the phone's battery saving or the sender's server?

    0
    • techpulseAI & Tech Digest

      Often the phone's battery optimiser, which delays messages to save power. The app's settings usually have an option to exempt it, though it costs a little battery.

      0