My app uses push notifications, and I'd like to turn on the Badge feature. When the person opens the app after a push notification, I want the badge number to reset. How do I make this happen?
My app uses push notifications, and I'd like to turn on the Badge feature. When the person opens the app after a push notification, I want the badge number to reset. How do I make this happen?
Hi, Doug.
Try this on Device Ready event
precodevar pushNotification = window.plugins.pushNotification;
pushNotification.setApplicationIconBadgeNumber(0);/code/pre
Perfect!
This code doesn't seem to be working any longer on iOS7. Anything else I need to do?
testing...
Hi Doug,
Instead of prepushNotification.setApplicationIconBadgeNumber(0);/preTry using this code:prepushNotification.setApplicationIconBadgeNumber(successHandler, 0);/preWhere codesuccessHandler/code is a function that should run when you set value (can be empty and do nothing).
Could you please elaborate on the successHandler function? I haven't been able to get the badge to reset to 0
Hi Nate -
Please provide more information about your issue. What exactly have you tried? And what and where is not working?
Hi Nate,
What event do you use for this code?
on DeviceReady I run:
var pushNotification = window.plugins.pushNotification;
pushNotification.setApplicationIconBadgeNumber(successHandler, 0);
but nothing happens to the badge