Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

How to prevent zeroing the badge when the application did become active ? #1

Open
nashfive opened this issue Jun 23, 2015 · 5 comments

Comments

@nashfive
Copy link

It seems that the plugin automatically resets the badge to zero each time the app becomes active (at least on iOS). How can I prevent this behavior if I want to keep the badge at its current value even if the app becomes active ?
A typical use case would be to handle a badge counter of unread messages (in the same manner than the Mail.app).

I don't want to modify and keep an out-of-sync version of the native code in my project repository that might break each time I update the plugin.
Could it be possible to benefit from the "resume" device event in the JS layer and reset the badge here only if needed ?

@kumaresan-cgvak
Copy link

@nashfive It is a bug in Plugin..!!!

@nashfive
Copy link
Author

@kumaresan-cgvak I don't think it is a bug. It makes sense to reset the badge each time the app becomes active, but when you need to avoid it, it's hard to come up with a workaround.

@kumaresan-cgvak
Copy link

@nashfive if the App developer wish to reset during this scenario, then he could reset it by using "pushNotification.setApplicationIconBadgeNumber(successCallback, errorCallback, "0");" during app resume status. Which adds more flexibility to developer.

@nashfive
Copy link
Author

@kumaresan-cgvak I agree... I should make a pull request, but I am not even sure that this is the official cordova plugin for push notifications...

@kumaresan-cgvak
Copy link

@nashfive I have made a pull request already. so, the issue could be resolved by merging the Pull request #2 that i have made.

If we use npm, then this plugin is used by Cordova.

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

No branches or pull requests

2 participants