Will iOS awake my app when i receive silent push notification?(When app is not in running state)

Hey awesome people, I'm doing emergency location based app and my flow is :


1) User install app

2) Upload device details to server (devicetoken, devicename etc)

3) Server can send silent push notification which contain lat,long,radius

4) Trigger the didReceiveRemoteNotification when received silent push notification

- This is working when app in running and suspended state

- Not working when user removed the app from switcher/not launched

5) If didReceiveRemoteNotification did trigger, init CLCircularRegion with lat,long and radius values and let monitoringRegion decide whether the user is in radius or not.

6) If the user in current radius show UILocalNotification to user.


I am new to iOS and I struggled with silent push notification,googled a lot and got stuck. Will iOS awake my app when i receive silent push notification when app is not launched(i.e when app is removed from app switcher)? thanks in advance.

"Maybe" is the best you can get. The OS decides whether or not to deliver silent push notifications based on deliberately undocumented heuristics. There is no API on iOS that will guarantee your app gets execution time in the background.


If you need reliability, the best is user visible (non silent) push notifications, but of course those don't run any of your app code unless the user taps on them to launch your app.


And when you say "emergency location based app" I assume you are aware of the App Review guideline that specifically prohibits the use of Core Location data for emergency services. (I think this applies to calling services like 911, not to user-to-user communications, but I'm not 100% sure on that point.) It sounds more like you're trying to notify users in the vicinity of some event whose location is known from the server side so maybe that's not an issue in your case.


Sadly I don't think what you're attempting is possible on iOS using notifications. They are either unreliable (silent push) or don't wake your app (regular push). You could accomplish it with continuous location monitoring I suppose but that would eat battery and annoy users.

Check out background refresh and it's limitations relating to push notifications. This article is a good place to start: https://medium.com/posts-from-emmerge/ios-push-notification-background-fetch-demystified-7090358bb66e#.fs520642o

That's a good article but be aware that it incorrectly uses the term "background fetch" to mean "performing a network request when your app is launched into the background in response to a silent push". Apple's use of the term "background fetch" is different - the official "background fetch" refers to the OS calling the performFetchWithCompletionHandler app delegate method, nothing to do with responding to notifications.

I can confirm "junkpile" about remote notifications.


to recap:


- remote pushes suffer form issued listed above and below.

- you could use location manager, changing ALL the logic:

a) App connects, asks for a spefic radius

b) set radius

c) localtion services will wake up app even if not running

d) do not use significant locationchanges to be notified... even if apple says is he preferred way, is VERY un-reliable

e) use continuous location monitoring, even if apple discourages it... it drain battery but NOT SO MUCH.

personally I used this approach and it works fine, even if app was killed, I can be awake and send a simple mesage to server

(and AFTER, if necessary, server will send a remote, NOT SILIENT, push)

ANYWAY wi-fi and 4G will consume power than geoloc..

Will iOS awake my app when i receive silent push notification?(When app is not in running state)
 
 
Q