Firebase push notification badge count is not being received in IOS app

Viewed 765

I am sending push notification with firebase from nodejs server.

the message payload is like this.

const notificationObjNew: any = {
        notification: {
            body: "demo body",
            title: "demo title",
            badge : "100",
        },
        topic: notificationTopic
    };

In IOS app I received this as-

{body:demo body,e:1,title:demo title}

Here is no badge property.

1 Answers

IOS receives badge count under aps key. You probably sharing JSON of alert itself which is under aps as well.

Normal Payload

"aps" : {
      "alert" : {
         "title" : "Game Request",
         "subtitle" : "Five Card Draw",
         "body" : "Bob wants to play poker",
      }
   }

with badge

"aps" : {
      "alert" : {
         "title" : "Game Request",
         "subtitle" : "Five Card Draw",
         "body" : "Bob wants to play poker",
      },
      "badge":9
   }
Related