When the push notification is received, the didReceiveRemoteNotification method of the App Delegate is called and then we can perform the required action and clear the badge.


 * Remote Notification Received while application was open.
– (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
     NSString *badge = [apsInfo objectForKey:@"badge"];
    NSLog(@"Received Push Badge: %@", badge);

     // set it to Zero will clear it.
     [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];