tezvyn:

Push notification data flow with APNs and FCM

AI-drafted, machine-checkedSource: interviewintermediate
WHAT IT TESTS

End-to-end push architecture.

OUTLINE

device registers and gets a token, server sends to FCM, FCM routes to APNs for iOS and directly for Android, the OS delivers to the app.

RED FLAG

thinking your server pushes straight to the device.

WHAT THIS TESTS Whether you grasp that push delivery is mediated by platform gateways you do not control, and the distinct roles of FCM and APNs.

A GOOD ANSWER COVERS The flow starts on the device: the app asks the OS to register for remote notifications and receives a unique device or registration token. The app sends that token to your backend, which stores it mapped to the user. When you want to notify a user, your server sends a request to FCM containing the target token and a payload. For Android, FCM delivers the message to the device through Google Play services, which wakes the app. For iOS, FCM acts as a relay: it forwards the message to APNs, Apple's gateway, which then delivers it over Apple's persistent connection to the device, where the OS presents the alert or wakes the app for data messages. So your server talks to FCM, FCM talks to the platform gateway, and the gateway talks to the device. Tokens can rotate, so you refresh and re-upload them.

COMMON WRONG ANSWERS Saying your server opens a connection straight to the user's phone. Forgetting that iOS still requires APNs even when you use FCM. Treating the device token as a stable user identifier rather than a per-install, rotatable token. Ignoring that tokens change and must be refreshed. Conflating notification messages with data-only messages.

LIKELY FOLLOW-UPS How do notification messages differ from data messages, what happens when the app is terminated, how do you handle token refresh, what are silent or background pushes, and how do you target topics versus individual tokens.

ONE CONCRETE EXAMPLE A chat app: when User A sends a message, your server looks up User B's stored FCM token and posts to FCM with the payload. FCM sees User B is on iOS and forwards the message to APNs; APNs pushes it down its connection to the iPhone; the OS shows the banner and, on tap, opens the app to the conversation. If User B were on Android, FCM would deliver directly through Google Play services without APNs.

Read the original → rnfirebase.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.