Mahesh
Mahesh

Reputation: 662

Which delegate method gets called when using Push Notifications if application is in background state?

Reading from Apple's documentation about Push Notifications:

  1. As a result of the presented notification, the user taps the action button of the alert or taps the application icon. If the action button is tapped, the system launches the application and the application calls its delegate’s application:didFinishLaunchingWithOptions: method
  2. The notification is delivered when the application is running in the foreground. The application calls its delegate’s application:didReceiveRemoteNotification: method

So my question is which delegate gets called if the application is in background state (it is running or it's suspended)? Is it application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification:?

Please help me, thank you!

Upvotes: 9

Views: 10262

Answers (2)

Water7
Water7

Reputation: 505

application:didReceiveRemoteNotification: is called when your app is in the background + the message alert still active.

Once the message alert is inactive then the application will not receive any event. Do correct me if I'm wrong.

Upvotes: 1

Amy Worrall
Amy Worrall

Reputation: 16337

application:didReceiveRemoteNotification: is called when your app is in the background. This question has an answer which tells you how to tell if your app was in the background or not.

Upvotes: 7

Related Questions