Mensur
Mensur

Reputation: 1308

Firebase Cloud Messaging Only Seeing Last Notification on Android

I am using FCM to send data push notifications to android devices via HTTP protocol. If I send several notifications, phone chimes that many times but I only only see the last notification that was sent in the notifications tray. I am NOT using the collapse_key so they should show up individually. Here is the payload:

{  
   "data":{  
      "testId":"3",
      "test2Id":"2",
      "title":"Test Alert Title 1",
      "body":"Test Alert Body 1"
   },
   "to":"DEVICE_REG_ID_XXXX"
}

UPDATE: On the device side, we're using phonegap-cordova-push plugin (https://github.com/phonegap/phonegap-plugin-push/tree/v1.9.x) in our Cordova app.

What am I doing wrong?

Upvotes: 4

Views: 1925

Answers (1)

Mensur
Mensur

Reputation: 1308

We were able to figure out the issue so I am posting for others who may have the same issue. The problem was with the plugin in question. Looking at the plugin code, we determined that the plugin was expecting attribute notId in the data payload to mark each notification as unique otherwise they'd get collapsed and only the latest would show up in the notification tray. So payload should like this:

{  
   "data":{  
      "testId":"3",
      "test2Id":"2",
      "title":"Test Alert Title 1",
      "body":"Test Alert Body 1"
      "notId":"45"
   },
   "to":"DEVICE_REG_ID_XXXX"
}

And sender needs to ensure that each FCM request has unique notId attribute.

Upvotes: 6

Related Questions