I'm not (yet :)) an expert in iOS development.
I use Cordova/PhoneGap to convert my Javascript app into native app.
I use PushPlugin in order to handle notifications.
The whole works well when user clicks on the notification alert: handled by the application through the onNotificationAPN
callback.
However, when user clicks on the app icon directly (with the badge incremented), the notification is not handled => onNotificationAPN
callback not fired.
I'm not expert in Objective-C and iOS environment but I'm suspecting this snippet code from PushPlugin to not achieve my requirement:
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"active");
//zero badge
application.applicationIconBadgeNumber = 0;
if (self.launchNotification) {
PushPlugin *pushHandler = [self getCommandInstance:@"PushPlugin"];
pushHandler.notificationMessage = self.launchNotification;
self.launchNotification = nil;
[pushHandler performSelectorOnMainThread:@selector(notificationReceived) withObject:pushHandler waitUntilDone:NO];
}
}
How to handle notification when user clicks on the app's icon rather than the alert ?
Especially, why isn't it a default in this plugin? Does it make sense I ignore?
Indeed, it would lead to many unprocessed notifications as users usually clicks on the app icon rather than the alert.