I'm implementing UILocalNotification
in my app, and the notifications are delivered as expected. As I have understood, the notifications are handled like this:
- When the application is not running, and the user click the notifiction, the app receives the notification through the options in the
applicationDidFinishLaunching
method. - When the application is active, it receives the notification through the
didReceiveLocalNotification
method. - When the application is in the background, and the user clicks the notification, it receives the notification through the
didReceiveLocalNotification
method.
But there is one case I have not been able to cover, and that is when a notification has been fired, the application is in the background, and the application is simply activated by clicking the app icon (instead of clicking the notification). In this case, there is no UILocalNotification
available. But I still would like to know that a notification has been fired since the last time it was active, since the notification has some information to be acted upon in it's userInfo
property.
Currently I have "solved" it by checking that the badge number is > 0 in applicationDidBecomeActive
, but this just allows me to show a general message to the user. I would prefer to be able to know what notification caused the badge number to update. Is there some way to achieve this?