You got response in Remote notification as below.
Connection OK sending message :{"aps":{"alert":"pushnotification testing","content-available":"","badge":"1","sound":"default"}} 134
In AppDelegte.h class
Take one integer variable int i=0;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
application.applicationIconBadgeNumber = 0;
UILocalNotification *localNoty=[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNoty) {
NSLog(@"Recieved Notification %@",localNoty);
}
return YES;
}
// Received notification
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
// Handle the notificaton when the app is running
app.applicationIconBadgeNumber=i++;
NSLog(@"Recieved Notification %@",notif);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
#if !TARGET_IPHONE_SIMULATOR
NSString *badge = [apsInfo objectForKey:@"badge"];
NSLog(@"Received Push Badge: %@", badge);
// set it to Zero will clear it.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
#endif
}
-(void) pw_setApplicationIconBadgeNumber:(NSInteger) badgeNumber
{
[UIApplication sharedApplication].applicationIconBadgeNumber +=badgeNumber;
}
// Set badges nil when apps become active.
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
application.applicationIconBadgeNumber =nil;
}