In recent times, Google moved from Google Cloud Messaging (GCM) to Firebase Cloud Messaging (FCM). Just like GCM.
Firebase Message Types:
1.Notification Message.
2.Data Message.
3.Both Notification & Data Message.
1.Notification Message:
- This Message is handled by firebase SDK itself
- This message can be send from firebase console
- Notification will be shown automatically when app is in background
- You have to use notification key
2.Data Message:
- Data message has to be handled by android app
- You have to use this,if you want to add some additional data along with the notification.
- Sending these messages through firebase console is not possible.
- You should use server side code to send the notification using firebase api.
- You have to use data key
3.Both Notification & Data Message:
- Message can contain both notification and data
- When this kind of message are send it will be handled depends on app state(back ground/fore ground).
When App is in Back ground: App receives the notification payload in the notification tray.and handle data payload when used clicked on notification.
When App is in Foreground: App receiver both payloads.
Firebase Message Targeting :
1.Send to Single User.
2.Topic Messaging.
1.Send to Single User:
When Single User is targeted,the firebase registration id is used to Identify the device.
The registration id has to be mentioned in to field
2.Topic Messaging:
This is useful when segment of users are targeted.
For this all user have to subscribe to firebase topic.
Topic Name has to be mentioned in in to field.