Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 530
Mensur Avatar asked Oct 18 '25 10:10

Mensur


1 Answers

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.

like image 57
Mensur Avatar answered Oct 19 '25 23:10

Mensur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!