1

I am trying to receive silent push notification when the app is totally off, but I'm not getting the push, what am I missing?

  1. I added in split: Required background modes -> App downloads content in response to push notifications

  2. I implement in the AppDelagate:

    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
    
    completionHandler(UIBackgroundFetchResult.NewData);
    JLToast.makeText("background").show()}
    
  3. I send a push:

    aps { content-available: 1 }

When the app is in background, I get the silent push notification, but when the app is out of background (totally shot down), I don't get the push.

What is missing?

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
ilan
  • 4,402
  • 6
  • 40
  • 76
  • You need to specify which iOS version you refer to, but by the signature of the Receive method, perhaps you mean iOS8? If so, Phuongs' answer below is incorrect. BUT.. there appears to be no truly concrete correct answer as i am reading exactly opposite answers in this specific area. Some say categorically yes, other say no. Evidence it showing me that this is one very weak area released by Apple. Technically, according to the docs: YES, it will wake up a non-running app. – drew.. Apr 21 '15 at 14:19
  • Hey ilan, I am facing the same problem. Did you get any solution? or what PhuongMaruko is saying correct? But I agree with @drew. – Dilip Lilaramani May 18 '15 at 19:00
  • still no solution, sorry. but it should work in IOS 8 – ilan May 19 '15 at 05:38
  • I verified in iOS 8, its not working. Check this accepted answer, seems correct: http://stackoverflow.com/questions/19068762/will-ios-launch-my-app-into-the-background-if-it-was-force-quit-by-the-user?lq=1 – Dilip Lilaramani May 19 '15 at 13:42

1 Answers1

1

As far as I know, silent push notification won't work in case the app is forced quit (by user). Consider 2 cases:

  • Force quit (by user, removing app from running apps list): app won't get notifications
  • Not force quit (Eg: when user restarts the phone, the app will be closed but it's not considered as being forced quit by user): the app will be launched in background mode and receive notifications
meaholik
  • 440
  • 5
  • 19