Challenge - 5 Problems
FCM Push Notifications Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediateHandling notification tap behavior
In a React Native app using Firebase Cloud Messaging (FCM), what happens when a user taps a notification while the app is in the background?
Attempts:
2 left
💡 Hint
Think about how notification listeners work when the app is opened from a notification tap.
✗ Incorrect
When the app is in the background and a notification is tapped, the app opens and the notification data can be accessed via the onNotificationOpenedApp listener provided by FCM libraries.
🧠 Conceptual
intermediateFCM token refresh handling
Why is it important to listen for FCM token refresh events in a React Native app?
Attempts:
2 left
💡 Hint
Think about what happens if the server has an old token.
✗ Incorrect
FCM tokens can change over time. If the app does not update the server with the new token, push notifications will not be delivered to the device.
❓ lifecycle
advancedNotification handling in different app states
Consider a React Native app using FCM. Which listener should you use to handle notifications received when the app is in the foreground?
Attempts:
2 left
💡 Hint
Foreground means the app is open and visible.
✗ Incorrect
The onMessage() listener handles messages received when the app is in the foreground. Background messages use a different handler.
🔧 Debug
advancedDebugging missing notifications on Android
A React Native app using FCM on Android does not show notifications when the app is killed (not running). What is a likely cause?
Attempts:
2 left
💡 Hint
Android requires a specific payload key to show notifications when the app is not running.
✗ Incorrect
On Android, notifications with only data payload do not show automatically when the app is killed. The "notification" key is needed for the system to display the notification.
expert
Navigating on notification tap with React Navigation
In a React Native app using React Navigation and FCM, how do you ensure the app navigates to a specific screen when a notification is tapped while the app is closed?
Attempts:
2 left
💡 Hint
Think about how to get notification data when the app starts from a closed state.
✗ Incorrect
When the app is closed, getInitialNotification() returns the notification that opened the app. You can then navigate based on its data after the app loads.
