Frontend & Design
10-Min Deep Dive

How does Push Notification work?

Push Notification: How it Works

SEO Keywords: push notification, mobile app, Android, iOS, APNs, Firebase Cloud Messaging, GCM, FCM

When you open a mobile app that's been sitting idle for days or weeks, the first thing you might see is a prompt asking if you'd like to receive updates. That's thanks to push notifications! Push notifications allow apps to send timely updates directly to your device, even when the app isn't running in the foreground. In this post, we'll dive into how push notification works and explore the key players involved.

How Push Notification Works

Push notifications are a way for mobile apps to send small amounts of data to devices without requiring users to open the app. Here's a simplified overview of the process:

  1. Registration: When a user installs an app, they're asked if they'd like to receive push notifications. If they agree, the app registers with a push notification service (more on this later).
  2. Server-side setup: The app's server is configured to send push notifications using the chosen push notification service.
  3. Notification creation: When an event occurs that warrants a push notification (e.g., a new message arrives), the app's server creates a notification payload containing relevant data (like title, message, and icon).
  4. Push notification service: The app's server sends the notification payload to the chosen push notification service.
  5. Service processing: The push notification service processes the request, encrypting and compressing the payload as needed.
  6. APNs or FCM: For iOS devices (using APNs – Apple Push Notification Service), or Android devices (using Firebase Cloud Messaging – FCM), the push notification service sends the encrypted payload to the corresponding service.
  7. Device receipt: The device receives the encrypted payload and decrypts it using its own secret key.
  8. Notification display: The decrypted payload is displayed as a notification on the user's device.

Key Players

Two main players are involved in the push notification process:

  • APNs (Apple Push Notification Service): For iOS devices, APNs acts as an intermediary between apps and devices. It's responsible for processing and delivering push notifications to Apple devices.
  • FCM (Firebase Cloud Messaging): For Android devices, FCM is a cloud-based messaging service that allows apps to send targeted messages to specific users or user groups.

TL;DR

In summary, push notifications work by:

  • Registering with a push notification service
  • Creating and sending a notification payload from the app's server
  • Processing and encrypting the payload at the push notification service level
  • Sending the encrypted payload to APNs (for iOS) or FCM (for Android)
  • Decrypting and displaying the notification on the user's device

By understanding how push notifications work, developers can better utilize this powerful feature to engage with users, enhance their app experience, and increase overall app success.

Propagate this knowledge. Link copied automatically on click.
How does Push Notification work? - 10-Minute Engineering Brief | DevExCode | DevExCode