How do push notifications work in a mobile app?
What the interviewer wants to hear
- App registers with FCM or APNs and gets a device token
- Token is sent to and stored by your backend
- Backend sends a message to FCM/APNs, which delivers it to the device
- User must grant notification permission
- Handle token refresh and tapping a notification to open the right screen
Model answer
Push notifications go through the platform services: Firebase Cloud Messaging for Android and Apple Push Notification service for iOS. When the app starts, it asks the user for notification permission, which is required on iOS and on Android 13 and later. It then registers with FCM or APNs and receives a device token. The app sends this token to our backend, linked to the user. When we want to notify someone, the backend sends a request with the token and payload to FCM or APNs, and they deliver it to the device even if the app is closed. In the app I handle token refresh, show the notification correctly in foreground, and when the user taps it I deep link to the right screen.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Mobile App Developer questions
- What is the difference between native and cross-platform mobile development? When would you choose each?
- Explain the lifecycle of a mobile app screen. Why does it matter?
- How do you handle network calls and errors in a mobile app?
- What is MVVM and why is it used in mobile apps?
- How do you run slow work like network calls or database reads in a mobile app without freezing the UI?
- What options do you have for storing data on the device, and how do you choose between them?
- How do you request runtime permissions like camera or location, and what do you do when the user says no?
- How do you make your app look good on different screen sizes, orientations and font sizes?
- What is the difference between declarative UI (Compose, SwiftUI, Flutter, React Native) and the older imperative style?