Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decoding the CLLocationAccuracy const's

the following are listed in CLLocation.h but from my experience they are deceiving names- possibly originally thought up to serve two purposes, 1. to test the accuracy of the location returned, but also 2. to set how hard the location manager works, specifically what is enabled (gps (how many sat channels), how hard the wifi works, triangulation etc.

extern const CLLocationAccuracy kCLLocationAccuracyBestForNavigation; // (raw value: -2) extern const CLLocationAccuracy kCLLocationAccuracyBest; // (raw value: -1) extern const CLLocationAccuracy kCLLocationAccuracyNearestTenMeters; // (raw value: 10) extern const CLLocationAccuracy kCLLocationAccuracyHundredMeters; // (raw value: 100) extern const CLLocationAccuracy kCLLocationAccuracyKilometer; // (raw value: 1000) extern const CLLocationAccuracy kCLLocationAccuracyThreeKilometers; // (raw value: 3000) 

I would love to take a look at CLLocation.m, but as that is not likely to happen any time soon- does anyone have any field testing showing what they think is going on with these different modes.

ie, kCLLocationAccuracyBest = 10 satellite (channels/trunks?), 100% power to wifi etc..

I'm kind of guessing at straws here- I think this is the type of information apple should have provided-

what I really want to know is, what is actually happening with kCLLocationAccuracyThreeKilometers in relation to battery draw- is the gps on? 1 sat trunk? wifi enabled? wifi on a timer? who knows? I know I'd like to

like image 206
dave Avatar asked Aug 05 '10 03:08

dave


1 Answers

I agree with Olie that hiding the details of the algorithm is intended to protect the app developer from worrying about how location is determined. That said, I believe it's still reasonable to ask the question: "what are the power implications of my accuracy selection?".

I have a little bit of information that might guide your decision on which to use, but I don't know the true details of Apple's implementation.

First, assume that as the reading becomes more accurate, the system will need to use more power-hungry radios. For example, the GPS will be required for the most detailed readings, inside 100 Meters, and it uses the most power.

Here is an educated guess at the mechanism used to determine the accuracy. List is ordered with (1) being the highest battery drain.

  1. GPS - kCLLocationAccuracyBestForNavigation;
  2. GPS - kCLLocationAccuracyBest;
  3. GPS - kCLLocationAccuracyNearestTenMeters;
  4. WiFi (or GPS in rural area) - kCLLocationAccuracyHundredMeters;
  5. Cell Tower - kCLLocationAccuracyKilometer;
  6. Cell Tower - kCLLocationAccuracyThreeKilometers;

When choosing, it is recommended by Apple that you select the most coarse-grained accuracy that your application can afford.

Hope that helps, a.little.

like image 83
Andrew Little Avatar answered Sep 19 '22 09:09

Andrew Little