0

I am creating an application that sends updated location to server regardless of app state. I have tried silent push to wake my application in background but it didnt work (it works fine except if my app is killed by user from app switcher). I am using location manager for getting current location.

Does IOS7 provides this feature to launch your application in background (even if app is killed by user from app switcher)??

I have spent five days without any success on this. If anyone can help me that would be highly appreciable.

Thanks in advance!!

nits
  • 61
  • 2

2 Answers2

0

If you need precise GPS locations you can set add the "location" value to the UIBackgroundModes array in your Info.plist as described in "UIBackgroundModes location and significant location changes with region monitoring". If you need only approximate locations you can use the startMonitoringSignificantLocationChanges method of CLLocationManager. As it is written in the documentation: "If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives."

Community
  • 1
  • 1
MrTJ
  • 13,064
  • 4
  • 41
  • 63
  • I preferred precise however It doesnt work on IOS6 and above when App is killed from app switcher by user. Also StartMonitoring I never got any event when App is killed by user from App Switcher. I am trying to get cached/current location even when app is killed by user. – nits Feb 12 '14 at 15:49
0

You can wake your app by using significantlocationchange. You have to start significant location change while you switch your app to background. Then system will wake your app after significant location change. The frequency is not faster than 5 min and for every 500 meters. You will have to catch the event by checking for LocationKey in didFinishLaunchingWithOptions in projects AppDelegate.

Nilesh
  • 438
  • 5
  • 15