Mohamed Reda Tech Logo
HomeArticlesApplicationsPhonesTutorialsTools
AR
Mohamed Reda Tech Logo
Mohamed Reda Tech

Tech articles, applications, and digital tools & services.

Follow Us
TelegramYouTube

Quick Links

ArticlesApplicationsTutorialsToolsPhones

Help

About UsAbout the authorEditorial policyContact Us

Stay Connected

Get notified when new articles, tools, and app updates are released.

© 2026 MR. All rights reserved.

Privacy Policy•Terms of Service•
How Push Notifications Work When Apps Are Closed | Mohamed Reda Tech
  1. Home
  2. Articles
  3. DevOps & Networking
  4. How Push Notifications Work Even When Apps Are Closed: The Architecture of FCM, APNs, and Persistent Sockets
DevOps & Networking

How Push Notifications Work Even When Apps Are Closed: The Architecture of FCM, APNs, and Persistent Sockets

An architectural exploration of mobile push delivery: resolving background thread exhaustion via single persistent TCP sockets, exploring FCM/APNs relay pipelines, payload parsing, and Doze mode mitigations.

By Mohamed RedaPublished: November 2, 2026Updated: November 24, 20264 min read
How Push Notifications Work Even When Apps Are Closed: The Architecture of FCM, APNs, and Persistent Sockets

A fundamental architectural conundrum frequently puzzles novice developers and system enthusiasts: How does a mobile handset render an immediate, deterministic notification banner for an incoming message when the associated application has been terminated and purged entirely from the operating system's active RAM footprint? If application execution threads are non-existent, what system process is actively listening for network events? The solution resides in one of modern distributed computing's most elegant paradigms: Centralized Mobile Push Gateway Architecture.

1. The Historical Engineering Impasse: Socket Exhaustion

During the nascent era of mobile operating systems, application architectures mirrored desktop conventions: every installed utility maintained its own independent background daemon, keeping persistent TCP/IP sockets bound to private server clusters. If a client device hosted 50 connected applications, 50 concurrent sockets were persistently polled across the cellular network.

The systemic outcomes were untenable:

  • Severe Battery Degradation: Continuous asynchronous heartbeat packets prevented the device's baseband radio modem from entering low-power sleep states, exhausting battery capacities in hours.
  • Cellular Network Flooding: Radio Resource Control (RRC) state transitions flooded carrier towers with constant keep-alive handshakes.
  • Memory thrashing: Excessive background resident set size (RSS) strangled mobile CPU and kernel task schedulers.

2. The Architectural Breakthrough: The Single Persistent Socket

To eliminate this architectural flaw, Google and Apple established unified platform-level delivery conduits:

  • Android Ecosystem: Governed by Firebase Cloud Messaging (FCM), coupled with persistent Google Play Services daemons.
  • Apple Ecosystem: Governed by the Apple Push Notification service (APNs), native to the core Darwin kernel.

The operational philosophy is unified: The operating system multiplexes all third-party push operations across a single, highly optimized, persistent TCP connection maintained exclusively between the device and the platform vendor's edge infrastructure. A solitary keep-alive handshake maintains carrier connectivity, drastically slashing power consumption while retaining sub-second message delivery latency.

3. End-to-End Delivery Pipeline: The Microsecond Lifecycle

Consider the granular telemetry sequence executed when an inbound message arrives while an application is in a terminated state:

  1. Event Generation: Client A transmits a payload to Application Server B.
  2. Device Token Query: Application Server B detects that Client B is offline from its primary application WebSocket. It retrieves Client B's unique, cryptographically signed Registration Token (assigned during initial app provisioning).
  3. Relay to Push Gateway: Application Server B issues an authenticated HTTP/2 POST request containing the token and structured JSON payload to the official gateway (FCM or APNs).
  4. Gateway Push via Dedicated Socket: The gateway engine identifies Client B's active socket mapping and pushes an encrypted packet across the pre-established system socket.
  5. System Daemon Ingestion: The mobile OS daemon (e.g., Google Play Services) accepts the packet, decrypts the gateway envelope, and verifies the target application identity.
  6. Independent System UI Rendering: The operating system—completely independent of the target application code—renders the notification banner within the system tray, executes haptic feedback, and plays alert sounds. The application process remains completely dormant in flash storage.
  7. Contextual Invocation: Only upon user interaction with the visual banner does the OS task scheduler instantiate the application process, passing the notification payload as an execution intent to route the viewport directly to the relevant conversation.

4. Notification Payloads: Visual Displays vs Silent Data Dispatches

Payload Category Processing Entity Resource Overhead Operational Use Case
Display Notification Rendered exclusively by OS system framework Negligible (App process remains unlaunched) Breaking news banners, promotional updates, standard alerts
Silent / Data-Only Push OS boots background task for a brief window (~30 sec) Moderate (Monitored strictly by OS power daemons) Encrypted E2EE key retrieval, silent inbox sync, background prefetching

5. Battery Governance and Doze Mode Throttling

Modern mobile operating systems enforce aggressive power states (such as Android's Doze Mode). When a handset remains stationary with the screen off, standard push events are deferred into consolidated maintenance windows to preserve battery cycles. Platform gateways resolve time-critical alerts (like VoIP calls) through an explicit High-Priority classification flag, which bypasses kernel sleep routines and wakes system modems instantly.

Related articles

DevOps & Networking

Why 100 Mbps Does Not Mean 100 MB/s Download Speed: Bits vs Bytes, TCP Overhead, and Real Throughput

A networking engineering explanation of why 100 Mbps bandwidth translates to ~11.5 MB/s actual download speed, analyzing bits vs bytes, TCP/IP packet overhead, protocol acknowledgments, and ISP throttling.

November 2, 20264 min read

Comments(0)

Leave a comment

Share your thoughts or questions. Your email will not be published.

No comments yet. Be the first to share your thoughts!

Tags

  • APIs

Frequently asked questions

Why do push notifications experience noticeable latency on certain OEM skins like MIUI or HyperOS?+

Aggressive proprietary battery management daemons terminate core background framework hooks or sever persistent socket handshakes to enforce aggressive standby metrics unless manual execution exceptions are configured.

Can central push gateways like Google or Apple intercept content within end-to-end encrypted messaging?+

No. Cryptographically hardened messaging protocols utilize silent data-only wake-up pings. The push payload contains no message text; receipt merely commands the client to negotiate a direct, encrypted socket to fetch and decrypt ciphertext locally.

DevOps & Networking

Computer Networking Essentials: OSI Model, Subnets, Routing, and Protocols

An architectural deep-dive into digital networking infrastructure: covering the TCP/IP and OSI stack, IPv4 CIDR blocks vs IPv6, Network Address Translation (NAT), recursive DNS resolution, and BGP routing mechanics.

October 15, 20264 min read
DevOps & Networking

Cloud Computing Demystified: Service Models, Virtualization, and Hyperscale Infrastructure

An architectural evaluation of cloud computing foundations: exploring the NIST essential characteristics, dissecting IaaS, PaaS, and SaaS abstraction models, evaluating the Shared Responsibility framework, and deployment topologies.

October 15, 20264 min read
DevOps & Networking

What is Linux? Why Developers Love It & How It Powers 90% of the Cloud

An architectural deep-dive into the Linux operating system, examining kernel vs distributions, Unix design philosophy, file permissions, shell piping, and why it dominates cloud computing.

October 15, 20264 min read