-2

I am trying to update the badge number on an app icon. My push notification is coming from the server and I know I will receive it in:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
}

My problem is, this method works only when the app is in the foreground but when my application is in the background how can I update the badge number?

I know that the applicationDidEnterBackground method will only be called when the home button is clicked.

Whymarrh
  • 13,139
  • 14
  • 57
  • 108
Bandish Dave
  • 791
  • 1
  • 7
  • 27
  • and then we have make another api call for reset that number on server side when application come in foreground.that is not right way. – Bandish Dave May 19 '14 at 15:05

1 Answers1

0

First of all

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

Is only intended to process notifications when your application is active, it is clearly indicated on the documentation.

The good way to change your badge number using a remoteNotification... is to indicate the badge number value inside the push notification. Please read the manual.

Jerome Diaz
  • 1,746
  • 8
  • 15