0

I'm writing an app that receives push notifications. When it gets one, and someone opens their phone through that notification, my application's delegate receives a application:didReceiveRemoteNotification: which comes with important notification data in the second argument.

However, if they get a push notification for another app, and open their phone through that, and then open my app, my apps notification is still queue in the pull-down notification center, and my app's delegate does not receive an application:didReceiveRemoteNotification: message with that push data until they tap that notification in the pull-down notification center. Ergo, I don't get the push data I want processed in my app regardless of how the user opens the app...

Is there a way I can get that notification in applicationDidBecomeActive: somehow?

Help appreciated. Thanks,

Nick

pachun
  • 926
  • 2
  • 10
  • 26
  • If you enable the multitasking background task, `-applicationDidReceiveRemoteNotification` will be invoked while your app is in background, but just in 10 mins. If the user doesn't active your app in 10 mins, your app will be pending, the `applicationDidReceiveRemoteNotification` will not be invoked. Next time, if the user taps on pull-down notification center to launch your app, you can receive the notification data, but if the user taps on app icon in, you cannot receive nothing about remote notification. – Elf Sundae Aug 14 '13 at 15:25
  • If you just want to detect if there's some notifications when the user taps on the icon that will open your app, you can use `if ([application applicationIconBadgeNumber] > 0) { // sync data, etc... }` in `applicationDidBecomeActive` method. – Elf Sundae Aug 14 '13 at 15:30

1 Answers1

3

Unfortunately, it isn't possible.

As far as I know, there are only two ways for your app to learn about a push notification:

  • The user opens your app by tapping/swiping the notification
  • You app is open when the device receives the push notification
Craig Siemens
  • 12,942
  • 1
  • 34
  • 51