title: handling application badge number for my iphone app for apple push notification
body: <p>I am sending notifications from server side to apns server,i was facing a small problem while handling badge,my badge number should be reduced if user has seen the notification in notification center, if app is already running no need of badge i think so, but always my badge number is "1"      </p>
  
  <p>from my server side i am sending badge="1".how to inform to server my app has particular badge number, how to know my badge number.</p>
  
  <pre><code>        - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
       {
   NSLog(@"%@",userInfo);
  UIApplicationState state = [application applicationState];
  [[UIApplication sharedApplication]setApplicationIconBadgeNumber:1];
  if (state == UIApplicationStateActive) {
      [[UIApplication sharedApplication]setApplicationIconBadgeNumber:0];
  
  
  
  
  
      NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@""
                                                          message:message
                                                         delegate:self
                                                cancelButtonTitle:@"Ok"
                                                otherButtonTitles: nil];
      [alertView show];
      [alertView release];
  
  }
  </code></pre>
  
  <p>}</p>