Check the FCM payload

This guide shows you how to fix an FCM push notification that Mobile Push Notifications delivers successfully but that doesn't display or behave as expected on an Android device. It covers only the pn_fcm block of your push payload. For a delivery failure on iOS, see Send push notifications on iOS instead.

Match the FCM message type to what your app expects​

Firebase Cloud Messaging (FCM) supports notification and data messages. Use the message type that matches whether FCM or your app displays the alert.

1{
2 "pn_fcm": {
3 "notification": {
4 "title": "Portugal vs Denmark",
5 "body": "great match!"
6 },
7 "data": {
8 "room": "Portugal vs Denmark",
9 "body": "great match!"
10 }
11 }
12}

Set notification in your pn_fcm payload if you want Android to display the alert automatically, with no app code involved.

Set data in your pn_fcm payload if your app needs to handle the push itself, such as updating UI state rather than only showing an alert. Your code, not the FCM SDK, is then responsible for displaying anything visible to the user.

Set both notification and data if you want Android to display the alert automatically and deliver custom data to your running app at the same time.

Check the payload against the size limit​

Keep your combined notification and data payload under the FCM limit.

ItemLimit
Push credentials per keyset1 APNs certificate and 1 FCM key
Push notification payload size2 KB for APNs, 4 KB for FCM

Was this page useful?

Last updated on