Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are various ways to go about this problem, and it ranges from how complex you want this battery-conscious code to get. The simplest solution is obviously just always using the GPS, however you can get very complicated very fast, such as taking samples every x amount of time, find the most accurate, predict where the user will be in the time leading up to your next sample using the previous samples, etc.</p> <ul> <li>The idea of a compromise is fine, however you need to factor in how much you want the users to use your app, how long it will be running for, and how accurate you need the data to be. In the end, it will come down to some trial and error in figuring out what the best combination of GPS and rough data is. You should know that the significant changes don't occur often, but obviously that's relative. If your app depends on users driving in a car at 60mph, then it might not take so long, but if its somebody walking around, then it can take much, much longer to trigger a significant change (if ever).</li> <li>I personally have not used this approach before, but all apps that I've done with CoreLocation require very accurate location data for a short period of time.</li> <li>The caveats to this approach is that it will take lots of trial and error, and may reduce performance of your app. Before you start coding this, you should figure out if your time making this work will pay off in the end. In addition, if you do decide to figure out where the user is traveling based on the samples, you will need to figure out if that actually saves battery - calculations like that could be pretty expensive battery-wise.</li> <li>Honestly, CoreLocation isn't THAT big of a battery hog, and Apple is constantly improving it's energy use. For example, look at Moves for iOS. As a user of it, I can say that the battery effect is almost none, and it's always using my location 24/7.</li> </ul> <p>If I'm not mistaken, Instruments allow you to monitor battery usage, so you can use that if you do decide to do a compromise to aid in your trial and error.</p> <p>Hope this helped!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload