0
0
Firebasecloud~10 mins

Notification messages vs data messages in Firebase - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a notification message with a title.

Firebase
const message = { notification: { title: '[1]' } };
Drag options to blanks, or click blank then click option'
AHello World
B123
Ctrue
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number or boolean instead of a string for the title.
Leaving the title empty or null.
2fill in blank
medium

Complete the code to send a data message with a key-value pair.

Firebase
const message = { data: { [1]: '12345' } };
Drag options to blanks, or click blank then click option'
Abody
Bnotification
CorderId
Dtitle
Attempts:
3 left
💡 Hint
Common Mistakes
Using notification keys inside data messages.
Using reserved keys like 'notification' inside data.
3fill in blank
hard

Fix the error in the message object to correctly send a notification with data.

Firebase
const message = { notification: { title: 'Sale' }, [1]: { discount: '20%' } };
Drag options to blanks, or click blank then click option'
Anotification
Bdata
Cpayload
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Repeating 'notification' instead of using 'data'.
Using incorrect field names like 'payload' or 'message'.
4fill in blank
hard

Fill both blanks to create a message with notification title and data key.

Firebase
const message = { [1]: { title: 'Update' }, [2]: { version: '1.2.3' } };
Drag options to blanks, or click blank then click option'
Anotification
Bpayload
Cdata
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping 'notification' and 'data' fields.
Using incorrect field names like 'payload' or 'message'.
5fill in blank
hard

Fill all three blanks to send a notification with title, body, and data key.

Firebase
const message = { [1]: { title: 'Alert', [2]: 'Check your app' }, [3]: { alertId: '789' } };
Drag options to blanks, or click blank then click option'
Anotification
Bbody
Cdata
Dpayload
Attempts:
3 left
💡 Hint
Common Mistakes
Putting 'body' as a separate top-level field.
Using 'payload' instead of 'data'.