Question

I have and issue where i want to collect GPS data periodically, say every 5 minutes. I can do this no problem when the app is running. However i wanted to know if there is a standard way to do this using the iPhone 'multitasking'. I can collect the data using the background process using the constant updating model and the significant changes, but these are either too battery intensive or to inaccurate.

I am in the process at looking the the NSLocalNotification, how ever i'm not sure the keeps the app in a background state while checking location periodically, i think this only has the option of launching the app.

Thank in advance.

Was it helpful?

Solution

There is no way to perform periodically GPS acquisition (each 5 min for example).

From Apple documentation:

Tips for Conserving Battery Power

Receiving and transmitting data using the radios of an iOS-based device require more power than any other operation on the device. Because Core Location relies on these radios to determine the user’s location, you should use location services judiciously in your applications. Most applications do not need location services to be running all the time, and so turning off those services is the simplest way to save power.

  • Turn off location services when you are not using them. This may seem obvious but it is worth repeating. With the exception of navigation applications that offer turn-by-turn directions, most applications do not need location services to be on all the time. Turn location services on just long enough to get a location fix and then turn them off. Unless the user is in a moving vehicle, the current location should not change frequently enough to be an issue. And you can always start location services again later if needed.
  • Use the significant-change location service instead of the standard location service whenever possible. The significant-change location service provides significant power savings while still allowing you to leave location services running. This is highly recommended for applications that need to track changes in the user’s location but do not need the higher precision offered by the standard location services.
  • Use lower-resolution values for the desired accuracy unless doing so would impair your application. Requesting a higher accuracy than you need causes Core Location to power up additional hardware and waste power for precision you are not using. Unless your application really needs to know the user’s position within a few meters, do not put the values kCLLocationAccuracyBest or kCLLocationAccuracyNearestTenMeters in the desiredAccuracy property. And remember that specifying a value of kCLLocationAccuracyThreeKilometers does not prevent the location service from returning better data. Most of the time, Core Location can return location data with an accuracy within a hundred meters or so using Wi-FI and cellular signals.
  • Turn off location events if the accuracy does not improve over a period of time. If your application is not receiving events with the desired level of accuracy, you should look at the accuracy of events you do receive and see if it is improving or staying about the same over time. If accuracy is not improving, it could be because the desired accuracy is simply not available at the moment. Turning off location services and trying again later prevents your application from wasting power.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top