2

I have an android app which can send notification to firebase and send messages to clients. My problem is how to get the BADGE COUNT which are responded by firebase ( how can I get the data which was in mBundle and map encirlced in the image). Please see the image, and explain me how to get that badge count.

I need that badge to display, update, and remove the count of notification in my application.

https://i.stack.imgur.com/a2wXZ.png

Which remoteMessage.getData() returns null. Thank you so much

suther
  • 12,600
  • 4
  • 62
  • 99
Jayrek
  • 53
  • 2
  • 9

1 Answers1

0

I have solved by passing badge number in the data.

{
  "to": "XXXXXXX",
  "priority": "high",
  "data": {
    "title": "Title",
    "badge": 99
  },
  "notification": {
    "content_available": true,
    "body": "Test",
    "title": "Title",
    "sound": "Default",
    "badge": 99
  }
}

then i get it with:

remoteMessage.getData().get("badge")
Luca Biasotto
  • 205
  • 1
  • 11