When you configure and implement FCM into your application, you may not see the mobile push notifications that you're sending. Before you start PubNub mobile push troubleshooting, ensure that you're sending and receiving the intended FCM type.
With FCM, you can send two types of messages to clients:
- Notification messages are sometimes thought of as display messages. These are handled by the FCM SDK and displayed automatically. Notification messages contain a predefined set of user-visible keys.
- Data messages, which are handled by the client app. Data messages, by contrast, contain only your user-defined custom key-value pairs.
- Maximum payload for both message types is 4KB, except when sending messages from the Firebase console, which enforces a 1024 character limit.
Following the above, it could be that your app is pulling or sending the wrong message type. For example, you could use one, the other or both of these message keys in your FCM message payload:
{ "pn_fcm" : { "notification": { "title":"My Title", "body":"message notification text" }, "android" : { "data" : {
"name":"John"
}, } } }
- You only need either data or notification (or both depending on use case)
- If you only send data, your code must handle displaying the notification
- If you send notification, it will be automatically displayed by Android