Home - shaikhalvee/FCM GitHub Wiki
Message types
- Notification messages - "display messages" (2KB limit)
- Data messages - handled by the client app (4KB limit)
FCM can send a notification message including an optional data payload. In such cases, FCM handles displaying the notification payload, and the client app handles the data payload.
Notification messages are delivered to the notification tray when the app is in the background.
Notification messages
{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
}
}
Keys for notification messages (see Table 2b.)
Data messages
{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"data" : {
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
},
}
Notification messages with optional data payload
Can be sent from Composer (hint - choose "Advanced Options")
{
"to" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}
}
- When in the background - apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification
- When in the foreground - your app receives a message object with both payloads available