A. Missing return or await before admin.messaging().send
B. Notification title is too long
C. Token variable name should be 'user_token'
D. Notification body cannot contain numbers
Solution
Step 1: Check asynchronous call usage
admin.messaging().send returns a promise and should be awaited or returned to ensure delivery.
Step 2: Verify other options
Title length is fine, token variable name is correct, and body can contain numbers.
Final Answer:
Missing return or await before admin.messaging().send -> Option A
Quick Check:
Async send needs await or return [OK]
Hint: Always await or return async Firebase calls [OK]
Common Mistakes:
Ignoring async nature of send()
Changing variable names unnecessarily
Thinking notification text rules are strict
5. You want to increase user engagement by sending personalized push notifications using Firebase. Which approach best ensures users receive relevant alerts without spamming them?
hard
A. Use user preferences stored in Firebase to send targeted notifications at optimal times
B. Send the same notification to all users every hour
C. Send notifications only when users open the app
D. Send notifications with random messages daily
Solution
Step 1: Understand personalization and timing
Using user preferences allows sending notifications that match interests and best times.
Step 2: Avoid spamming users
Sending the same or random messages frequently annoys users and reduces engagement.
Final Answer:
Use user preferences stored in Firebase to send targeted notifications at optimal times -> Option A