Search code examples
iphoneobjective-ccllocationmanagercllocation

iPhone Brainstorm - CLLocation in Background - Polling every 15 minutes


Here is the scenario. I need to have an application which polls a web service with the users location every 15 minutes whether in background / foreground.

At the moment I:

  1. Start / Restart the location manager with accuracy highest and distance filter none.
  2. Wait to get within desired accurancy.
  3. Store reading
  4. setDesiredAccuracy to be: "kCLLocationAccuracyThreeKilometers"
  5. setDistanceFilter to be: 1000
  6. Set a performSelector:@selector(getLocation) withObject:nil afterDelay:900
  7. Start again from step 1.

I want to make this the most battery saving method possible and would like to see what fellow 'stackers think of the option above and if you guys have any other suggestions.

Thanks James.


Solution

  • In the end I got the application to start / stop the location manager every 15 minutes on a performSelector: WithDelay.

    Basically when the CLLocationManager gave a reading within the desired accuracy I lowered the CLLocation to significate changes then set the application to take another reading 15 minutes later, changed the accuracy to one of the highest settings and repeated.

    Hope this helps anyone in the future. Thanks James