views:

791

answers:

2

When the iPhone can't find a GPS signal, it uses Wifi to guess at your GPS location.

When it can't find your Wifi location, it defaults to the wifi network where you activated your phone.

Is there any way to determine when these two forms of location are occurring?

The LocationManager provides a horizontalAccuracy reading, but if you are using your home Wifi, it says (rather inaccurately) that it has a +/-500 range, even if you are miles away.

Also, is it posible to know how many satellites the phone is reading?

A: 

Not using public APIs. It might be possible to find private APIs and link against them to find out this information, but Apple won't like that and might reject your app from the App Store.

mythogen
+2  A: 

The basis for your question isn't quite right...
CoreLocation uses 3 different means to tell where you are:

1) GPS - Most Accurate, Eats most battery
2) Cellular Triangulation - Still Accurate, Eats some battery
3) Wifi - Precisely Accurate, but to the registered place where the wifi network is, so will be least accurate to where you are; Eats some battery

CoreLocation allows you to tell it how accurate you want your "guesses" and then starts doing a mix of 2 and 3 depending on whether you have wifi or cell at the moment. It starts giving you guesses almost immediately (not very accurately) and will turn on the gps in situations where it is needed.
As far as knowing which is being used, no, I don't think you can tell, but you might want to qualify why you're interested, because there may be other ways to accomplish what you need.

Note: There may be some flaws in that explanation, but that's what I got from an Apple iPhone Development Rep who new his stuff.

TahoeWolverine
To explain what I am doing, I have a GPS recording app. I'd like to indicate to the user if they are getting a real signal. For now, I have just set the app to say the signal is poor if they can't get a reading within 150m, but I'd like to be able to tell them exactly what's going on.
Andrew Johnson
By the way, I'm also in Tahoe. I live in Sierra Meadows in Truckee.
Andrew Johnson
Response to first comment: That seems totally reasonable, but unfortunately Apple isn't that open. Consider this, also: there are many times when GPS will not be very accurate (inside, reflecting off buildings, etc.) so knowing that the GPS is being used or that it's giving the answer may not actually mean much. Response to the second comment: Awesome! I wish I were back, but I'm out in the Midwest for a while. I should be back at Alpine at least once this winter...(praying)
TahoeWolverine