Valentin Shamardin
Valentin Shamardin

Reputation: 3658

Is it possible to detect push-notification arrival?

I can catch an event of opening push-notification via

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

but user may receive push-notification, but doesn't open it. So is it possible to handle an arrival of push-notification?

Upvotes: 2

Views: 2571

Answers (1)

Stavash
Stavash

Reputation: 14304

The method you are referring to in your question is called only if a push notification was received while the app was running in the foreground. In order to handle push notifications that were used to launch the application (or bring the app back from the background), you need to check the "options" dictionary within your appDelegate's didFinishLaunchingWithOptions method.

To answer your additional question - no, if the user didn't open your app with a push notification, there's no way you can gain access to it.

Upvotes: 5

Related Questions