Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local notifications with badge #1745

Open
stefanwilliam96 opened this issue Jan 17, 2019 · 4 comments
Open

Local notifications with badge #1745

stefanwilliam96 opened this issue Jan 17, 2019 · 4 comments

Comments

@stefanwilliam96
Copy link

can local notification automatically generate badge in apps icon ?

@fakir22
Copy link

fakir22 commented Jan 21, 2019

As seen on the documentation, there is a 'badge' property for notification object.

Property
Badge
Type
Number
Description
The number currently set as the badge of the app icon in Springboard (iOS) or at the right-hand side of the local notification (Android) - Default: 0 (which means don't show a number)

So I think you could use something like this :

// Set your desired value here or increment it from previous actions
var badgeNum = 1; 

// Change some default values here
cordova.plugins.notification.local.setDefaults({
    badge: badgeNum
});

I didn't try it but it should work.
Hope it helps !

@stefanwilliam96
Copy link
Author

As seen on the documentation, there is a 'badge' property for notification object.

Property
Badge
Type
Number
Description
The number currently set as the badge of the app icon in Springboard (iOS) or at the right-hand side of the local notification (Android) - Default: 0 (which means don't show a number)

So I think you could use something like this :

// Set your desired value here or increment it from previous actions
var badgeNum = 1; 

// Change some default values here
cordova.plugins.notification.local.setDefaults({
    badge: badgeNum
});

I didn't try it but it should work.
Hope it helps !

the problem is, this local notification plugin using badge plugin which didnt worked :v

@fakir22
Copy link

fakir22 commented Jan 22, 2019

@katzer is also the creator of the badge plugin and said the following on this issue (katzer/cordova-plugin-badge#124)

Please notice that the plugin only supports devices that are supported by ShortcutBadger. There's no error if its not possible to set a badge. The cordova plugin nor the underlying ShortcutBadger cannot know if its working or not because its not a core Android API.

I don't know where the problem come from but you could start by using the "IsBageWorking" tool provided on ShortcutBadger page : https://github.com/leolin310148/ShortcutBadger#isbadgeworking

A tool for displaying your device, launcher & android version and testing whether ShortcutBadger works or not may.

@stefanwilliam96
Copy link
Author

@katzer is also the creator of the badge plugin and said the following on this issue (katzer/cordova-plugin-badge#124)

Please notice that the plugin only supports devices that are supported by ShortcutBadger. There's no error if its not possible to set a badge. The cordova plugin nor the underlying ShortcutBadger cannot know if its working or not because its not a core Android API.

I don't know where the problem come from but you could start by using the "IsBageWorking" tool provided on ShortcutBadger page : https://github.com/leolin310148/ShortcutBadger#isbadgeworking

A tool for displaying your device, launcher & android version and testing whether ShortcutBadger works or not may.

yeah i know, i already try his badge plugin but didnt work for me lol xD anyway thanks for your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants