React Native · Mobile UI at native speed
How do push notifications work in a React Native app?
Short answer
The app registers with APNs or FCM, sends the device token to your backend, and the backend sends pushes through those services. Handle permission, token refresh, foreground display and notification taps explicitly.
Push delivery is a chain: the OS push service reaches the device, the app receives the payload, and your code decides whether to display, update state or navigate. React Native libraries wrap the native APIs, but the token and permission lifecycle is still yours to manage.
import * as Notifications from "expo-notifications";
export async function registerForPush(projectId: string) {
const permission = await Notifications.requestPermissionsAsync();
if (!permission.granted) {
return null;
}
const token = await Notifications.getExpoPushTokenAsync({ projectId });
await fetch("https://api.example.com/devices", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token: token.data, platform: "mobile" }),
});
return token.data;
}Lifecycle details that break in production
- Tokens rotate; re-register on every launch and replace the old token server-side
- Foreground notifications need an explicit handler to display or suppress them
- Taps must be handled for cold start, background and foreground launches
- Android channels control importance and sound; create them deliberately
- Remove tokens on logout so the next user does not receive the previous user's pushes
Notification payloads should be small and contain an identifier, not the full data model. Fetch the current record when the user opens the notification so the screen shows fresh data rather than a stale snapshot.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Why do device tokens change?
- 2How do you handle a notification tap on cold start?
- 3What are Android notification channels?
- 4Why should the push payload contain an id rather than full data?
Say it in the interview
The app asks for permission, registers with APNs or FCM, and sends the token to our backend, re-registering whenever it rotates. I handle foreground display and taps from cold start, background and foreground separately, and I clear the token on logout. The payload carries an identifier so the app fetches fresh data instead of trusting a stale snapshot.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React Native mock interview and get scored feedback on depth, clarity and confidence.