When you configure and implement FCM into your PubNub application, you may not see the push notifications that you are sending. Before you do any PubNub mobile push troubleshooting, please be sure that you are sending, and receiving, the intended FCM type. The following comes directly from the Android FCM docs:

With FCM, you can send two types of messages to clients:

  • Notification messages, sometimes thought of as "display messages." These are handled by the FCM SDK automatically.
  • Data messages, which are handled by the client app.
  • Notification messages contain a predefined set of user-visible keys and can contain an optional data payload. 
  • 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 code in your app is pulling the wrong message type or you are sending the wrong message type. For example, you could use one, the other or both of these message keys in your FCM (formerly known as, GCM) message payload: data or notification.

{
    "pn_gcm" : {
        "notification": {
            "title":"Portugal vs. Denmark",
            "body":"great match!"
        },
        "data" : {
            "body" : "great match!",
            "room" : "PortugalVSDenmark"
        }
    }
}


You only need either data or notification (perhaps both depending on your use case) but it does matter if you only send data because your code is explicitly responsible for displaying the push notification, whereas notification will be automatically displayed by Android.


See also: