Push notifications and background work · senior
Handling notifications: app states, data-only messages and channels
What runs when a push arrives depends on the app state and the message type: the OS shows notification messages in the background, data-only messages wake a background handler that must be registered outside React, taps are read with initial/opened handlers, and Android channels decide how a notification looks and sounds.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Foreground: FCM never shows a system notification on Android by itself; onMessage runs and you display it. expo-notifications uses setNotificationHandler; SDK 58 shows foreground notifications by default.
- Background or quit (Android): setBackgroundMessageHandler runs headless JS. Register it in index.js before AppRegistry.registerComponent, keep it short, and do not touch React state.
- Data-only messages are low priority by default. Android: send high priority sparingly (Doze). iOS: content-available: 1, apns-push-type: background, apns-priority 5; they are throttled, not delivered after the user force-quits the app, and not in Low Power Mode.
- Taps: getInitialNotification (cold start) and onNotificationOpenedApp (from background); in expo-notifications, addNotificationResponseReceivedListener / useLastNotificationResponse. Route them through your deep-link config.
- Android 8+ channels: importance, sound and vibration are fixed at creation; after that the user owns them. To change behaviour, create a new channel.
- Android 12+ forbids notification trampolines: a tap must open an Activity directly.
- notifee was archived on 7 April 2026; its README points to expo-notifications (works in bare apps) or the react-native-notify-kit fork.
The red pen
Common traps: mistake → fix
Mistake: "Register the background handler inside a component"
Fix: it must be in index.js before registerComponent.
Mistake: "A silent push reliably wakes an iOS app"
Fix: it is throttled and stops after a force-quit.
Mistake: "Change a channel's importance in code later"
Fix: the user controls it after creation.
Mistake: "Keep using notifee"
Fix: it is archived; plan a migration behind your own interface.
Easy to hard
Questions interviewers ask, easy to hard
- A data message arrives when the app is open, in the background, and swiped away. What runs in each case?
- Why must the background handler be registered in index.js?
- iOS: will a data-only message wake an app the user force-quit?
- You rely on notifee for channels and grouped notifications. It is archived. What is your plan?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.