1

I have created the application, which track the GPS Location of user at specific time period. This process is run 3 times in background. So, App need to keep alive in background.

To achieve the our requirement, we use the Location manager (GPS) running in the background. So, it will never been killed by OS. Also, we have run the background task thread while App is in background.

This approach working fine on iOS 6 and before and running more than 10 minute in background.

But in iOS 7 Application going to killed after 10 minute.

Please need suggestion for keep the Timer alive in background.

We would appreciate the earliest response. Thank you in advance.

How to keep app running alive in background in IOS 7 without affecting the battery life.

Kapil Choubisa
  • 5,152
  • 9
  • 65
  • 100
IOSDev_RKM
  • 41
  • 2
  • 4
  • Is your question how to keep my app live in background? – Tarek Hallak Sep 13 '13 at 10:51
  • why do you need the timer to track user's location periodically? Location Manager itself will trigger the new location when user moves from one location to another location according to the location manager configuration? – Nandha Sep 17 '13 at 07:22
  • Is there a reason you need to run it in the background all the time, besides gathering location? If you're using GPS in the background, you only need to check the "Location updates" box under "Background Modes" in your project target info, and iOS will handle this for you. – Big-O Claire Nov 18 '13 at 15:58

2 Answers2

0

There's no reason for the app to be killed if it has background location tracking functionality in the Info.plist file and doesn't try to abuse the benefits of that permission.

I'm not sure what's your use case for the tracking functionality, but -- together with an assumption that if there's no record from some period, the tracked device didn't change the location -- setting a distance filter would allow to track the location all the time.

That also allows to put a smaller burden on device's battery, because in certain activity types handled by CLLocationManager, the device may put the location service in idle state if it doesn't detect any significant movement.

macbirdie
  • 16,086
  • 6
  • 47
  • 54
0

if you want to keep app active in background and don't want to go to appstore for some reason (for example you are developing something for your company with using enterprise developer program), you should check deferredLocationUpdates(even on devices which doesn't support them, you just get error in your delegate but app will work) and don't call stopLocationUpdates while in background.(if you use this on app for appstore you have to explain why you needed this to apple of course).

Tauri
  • 1,291
  • 1
  • 14
  • 28