0
0
Firebasecloud~20 mins

Notification handling in background in Firebase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Notification Handling Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does Firebase Cloud Messaging handle notifications when the app is in the background on Android?

When a Firebase Cloud Messaging (FCM) notification is sent to an Android device and the app is in the background, what happens to the notification?

AThe notification is automatically displayed in the system tray without invoking app code.
BThe app receives the notification data immediately and processes it in the background service.
CThe notification is discarded and not shown to the user.
DThe app wakes up and shows a custom notification UI immediately.
Attempts:
2 left
💡 Hint

Think about how Android handles notifications when the app is not active.

Architecture
intermediate
2:00remaining
Which Firebase service is best suited to trigger background notification handling logic?

You want to run custom code in the background when a notification arrives, even if the app is closed. Which Firebase service should you use?

AFirebase Cloud Functions triggered by Firestore changes
BFirebase Cloud Messaging data messages handled by a background service
CFirebase Realtime Database listeners in the foreground app
DFirebase Authentication triggers
Attempts:
2 left
💡 Hint

Consider which message type allows background processing on the device.

security
advanced
2:00remaining
What is a security risk when handling background notifications with data messages in Firebase?

When using Firebase Cloud Messaging data messages to handle notifications in the background, what security risk should you be aware of?

AData messages automatically expose user credentials.
BNotifications can only be sent to authenticated users.
CBackground services cannot access the internet.
DData messages can be intercepted and modified if not encrypted.
Attempts:
2 left
💡 Hint

Think about data transmission security over networks.

Configuration
advanced
2:00remaining
Which manifest permission is required for background notification handling on Android with Firebase?

To receive Firebase Cloud Messaging data messages in the background on Android, which permission must be declared in the AndroidManifest.xml?

A<uses-permission android:name="android.permission.WAKE_LOCK" />
B<uses-permission android:name="android.permission.INTERNET" />
C<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
D<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Attempts:
2 left
💡 Hint

Consider what permission allows the app to keep the device awake to process messages.

Best Practice
expert
2:00remaining
What is the best practice to ensure reliable background notification handling on iOS with Firebase?

On iOS, background notification handling is limited. Which approach best ensures your app processes notifications reliably in the background?

ADisable background modes to save battery and rely on user opening the app.
BUse local notifications scheduled by the app instead of remote notifications.
CUse silent push notifications with content-available flag and enable background fetch capability.
DSend only notification messages without data payload to wake the app.
Attempts:
2 left
💡 Hint

Think about how iOS allows apps to run code in the background.