Bongeh
Bongeh

Reputation: 2300

Notification Center - How do I know if there is an 'unread' notification?

In my app, I have a push notification server working correctly, I receive notifications as expected.

If I am in the app and I receive a notification

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

is called..

If I am outside of the app, and I receive a notification, and click onto it..

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

is called..

If I am outside of the app, receive a notification and load my app by clicking on its icon on the springboard..

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

is not called... ?????

I don't understand why this is, surely there is a way to check notification center and say, 'hey! notification center, do I have any unread aps payloads to deal with?'

Upvotes: 3

Views: 1965

Answers (1)

Mazyod
Mazyod

Reputation: 22559

Instead of going through all the comments, the conclusion is as follows:

  1. Set the Icon badge number
  2. Upon launching the application, or return from background, check the app badge.
  3. Decide whether to request any data from the server or not.

This is a solution, but we are also interested in:

Can you query the notification center instead?

Upvotes: 4

Related Questions