9

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!

marzapower
  • 5,531
  • 7
  • 38
  • 76
Mahesh
  • 662
  • 2
  • 11
  • 30

2 Answers2

7

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.

Community
  • 1
  • 1
Amy Worrall
  • 16,250
  • 3
  • 42
  • 65
  • Thank You very much Amorya. Actually currently i cant test my app with push notification as our server is busy so i needed to post question instead directly finding out the answer in real situation. – Mahesh May 25 '11 at 08:25
1

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.

DShah
  • 9,768
  • 11
  • 71
  • 127
Water7
  • 495
  • 1
  • 4
  • 9