2

How can I prevent PushPlugin from reseting my badge count to 0 after entering the app from the background?

Arjun Patel
  • 266
  • 5
  • 18

1 Answers1

3

I just came across this problem as well.

For some reason this is intended behaviour. It's because in the com.phonegap.plugins.PushPlugin, the badge get cleared to 0 when the app get active again.

I ended up editing the plugin:

In the file "AppDelegate+notification.m", in the method:

"- (void)applicationDidBecomeActive:(UIApplication *)application {"

Change line ~90:

//zero badge
application.applicationIconBadgeNumber = 0;

to:

//zero badge
//application.applicationIconBadgeNumber = 0;

(I just ended up commenting it out).