Push & Local Notifications
Send and receive push notifications through FCM and APNs, schedule local notifications, and handle taps that deep link into the app.
Intermediate · about 7 hours · difficulty 3/5
Learn first: Deep Links, Universal Links & App Links, Authentication & Session Handling
Notifications bring users back, but they are also the fastest way to get your app muted or uninstalled. Build them well and use them sparingly.
How push works
- The app asks the user for permission (always on iOS; on Android 13+ too).
- The OS gives the app a device token from APNs (Apple) or FCM (Google).
- Your app sends the token to your backend, tied to the user.
- Your backend sends a message to APNs/FCM (or through Expo's push service or Firebase), which delivers it to the device.
What to handle
- Foreground vs background: decide whether to show a banner while the app is open.
- Tap handling: include a route or deep link in the payload and navigate when the user taps, including from a cold start.
- Android channels: group notifications by type so users can mute some but not others.
- Local notifications scheduled on-device for reminders, no server needed.
- Token refresh: tokens change; update your backend when they do and remove invalid ones.
Good practice
Ask for permission in context ("Get notified when your order ships?") rather than on first launch. Respect quiet hours and provide in-app settings.
Good enough to move on: tapping a push notification from a killed app opens the correct screen.
Key concepts
- APNs and FCM
- Device tokens and registration
- Permission prompts in context
- Foreground and background handling
- Notification taps and deep links
- Android notification channels
- Local scheduled notifications
- Rich notifications and actions
Mini project
Add push notifications to your grocery app so adding an item notifies other list members, and tapping the notification opens that list.
Check yourself
Walk through every system involved between your backend deciding to notify a user and the banner appearing on their iPhone.
Free resources
- Expo: Push notifications overview (Expo)
- Firebase Cloud Messaging (Firebase)
- Apple User Notifications (Apple)