0

how do we handle push notification if app is in background mode? means i want to get push notification alert message when I am reopen the application after got the push notification alert.

can I do this ?

I am using this method when my my app is in active mode.

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

}

But when the app is not active, so how to get this?

ChandreshKanetiya
  • 2,414
  • 5
  • 27
  • 41
  • 1
    Refer this link may be helpful to you http://stackoverflow.com/questions/38007027/how-to-detect-remote-notification-in-didfinishlaunchingwithoption-application-me/38007927#38007927 – HariKrishnan.P Jul 11 '16 at 07:12

2 Answers2

1

You don't. Your app is not guaranteed to receive notifications. If the user taps the "open" button then your app will start with the dictionary passed in as the startup parameters in application:didFinishLaunchingWithOptions:. Of course, you users might tap cancel instead.

Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
0

If the user taps the notification then only trigger to get the notification payload (or) userInfo dictionay value. which using below code in appdelegate file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
  if (notification)
  {


  }
}
HariKrishnan.P
  • 1,204
  • 13
  • 23