Badge not displaying value passed in to .set() function

ionic native Badge does not display value passed to this.badge.set(5)

this.badge.set(20).then(() => { console.log(“did set”) })

the console.log(“did set”) actually gets printed but the value is not displayed

Is there something I did incorrectly? I anticipate any response thanks.

1 Like

Not a lot to go off of from this, do you have a more complete example?

Hey Harting, according to the Doc, I just needed to do this

constructor(private badge: Badge, private platform: Platform){

// Just to test I set the badge

console.log(“Did set”)

that’s All I had to do, the ''Did set" gets printed in the console.log but the value 5 doesn’t show at all.

No need for the DMs…

Do you have an example app or demo to look at?

Please clone the repo to check it out.

This was all I did so far just to test the Native Badge

constructor(private badge: Badge, private platform: Platform) {
      this.platform.ready().then(() => {
           this.badge.set(10).then(() => console.log("Test badge"))

Is it possible that the most recent commit to the Ionic-Native shim is relevant here?

I have the same issue as @easyadin described.

   async () => {
       await this.badge.set(1);
       console.log(await this.badge.get()); // 1

In this case the value will be 1, but the badge will be not displayed on application icon.

Adding some additional data that might help:

"@ionic-native/badge": "^5.30.0",
"@ionic/angular": "^5.5.2",
"@ionic/angular-toolkit": "^2.3.3",

Its works for some devices.
I realised the problem is not from ionic framework or plugins.

According to this information provided on the Badge docs

Android Note: Badges have historically only been a feature implemented by third party launchers and not visible unless one of those launchers was being used (E.G. Samsung or Nova Launcher) and if enabled by the user. As of Android 8 (Oreo), notification badges were introduced officially to reflect unread notifications. This plugin is unlikely to work as expected on devices running Android 8 or newer.
1 Like

Thank you for the response.
To sum up, badge value change is possible If you send a badge number as a part of Push Notification.

1 Like