Cordova-plugin-firebase: Add badge when receive notification

Created on 30 Mar 2018  ·  3Comments  ·  Source: arnesson/cordova-plugin-firebase

I try to add badge number when receive message from server but it don't add badge number until I tapped on notification.

How to add badge number when device receive message?
Help me please.

  • I use setBadgeNumber and onNotificationOpen
    ******* My code *******
    this.firebase.onNotificationOpen().subscribe((res) => {
    this.firebase.setBadgeNumber(1)
    if(res.tap){
    console.log("Received in background");
    } else {
    console.log("Received in foreground");
    }
    }, (err) => console.log(err) )
question

Most helpful comment

@remisture Yes. I try to set badge number (badge = 1). I send it but if I receive message and do not open notification or application when I send message again badge number on my application still get 1

All 3 comments

Set badge number when you send the message.

@remisture Yes. I try to set badge number (badge = 1). I send it but if I receive message and do not open notification or application when I send message again badge number on my application still get 1

Was this page helpful?
0 / 5 - 0 ratings