Page 1 of 4

Reset Push Badge

Posted: Tue Nov 12, 2013 3:35 pm
by Doug Black

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?


Reset Push Badge

Posted: Tue Nov 12, 2013 4:43 pm
by Oleg Danchenkov

Hi, Doug.
Try this on Device Ready event
precodevar pushNotification = window.plugins.pushNotification;
pushNotification.setApplicationIconBadgeNumber(0);/code/pre


Reset Push Badge

Posted: Tue Nov 12, 2013 5:59 pm
by Doug Black

Perfect!


Reset Push Badge

Posted: Thu Jan 23, 2014 11:47 am
by Doug Black

This code doesn't seem to be working any longer on iOS7. Anything else I need to do?


Reset Push Badge

Posted: Thu Jan 23, 2014 7:02 pm
by Maryna Brodina

testing...


Reset Push Badge

Posted: Fri Jan 24, 2014 12:54 pm
by Kateryna Grynko

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).


Reset Push Badge

Posted: Fri May 09, 2014 2:05 am
by Nate Kahl

Could you please elaborate on the successHandler function? I haven't been able to get the badge to reset to 0


Reset Push Badge

Posted: Fri May 09, 2014 4:19 am
by Illya Stepanov

Hi Nate -

Please provide more information about your issue. What exactly have you tried? And what and where is not working?


Reset Push Badge

Posted: Fri May 09, 2014 8:06 am
by Serhii Kulibaba

Hi Nate,

What event do you use for this code?


Reset Push Badge

Posted: Fri May 09, 2014 1:19 pm
by Nate Kahl

on DeviceReady I run:
var pushNotification = window.plugins.pushNotification;
pushNotification.setApplicationIconBadgeNumber(successHandler, 0);

but nothing happens to the badge