views:

238

answers:

6

hey guys

i am creating an app that uses location-

everything works swimmingly except one thing-

when i come home my iphone connects to my local wifi network and instead of getting my location using the gps in the phone it tries to get it by figuring out where my wifi network is connected to- if i turn my wifi off it keeps an accurate location point-

as soon as my phone is connected to my wifi network it starts telling me my location is several km/miles from my actual point.

i would like my app NOT to use the wifi network to try get my location-

is there a way i can- a. tell if a location point has been derived from the GPS so i can ignore locations derived from the wifi network. b. stop location services jumping over to wifi for location

thanks guys-

cheers, dave.

+1  A: 

Other than asking the user to turn off his Wifi, there's no documented way you can force the location manager to use GPS over Wifi. It might be possible with private API, but that would also get you rejected from the App Store.

Dave DeLong
hey dave- thanks for that reply- i was afraid of that- i couldnt find anything after scouring the net- im hoping someone has a sly way of doing it without app store rejection- may have to end up doing some sort of time/distance calculation between points to see if the new location is physically unfeasible, but that would be a pretty poor solution- cheers, dave.
dave
A: 

You can set cLLocationAccuracy.desiredAccuracy = kCLLocationAccuracyBest and see if that does it. It should try and limit to GPS use, however that isn't 100% guarenteed.

jamone
hey jamone- thanks for that reply- yeah i have it set to best but the locations services seem to give preference to wifi over the gps- cheers, dave.
dave
A: 

A-GPS = GPS + cell tower triangulation. There is no WI-FI positioning.

Adrian Pirvulescu
hey adrian, thanks for that reply- my iphone is giving me the same location at home as my ipod, and my ipod doesnt have gps or cell reception- im presuming my iphone is grabbing the location from the same place as my ipod is getting it from- i should note: i get no phone reception in my house (tin roof lol)- cheers, dave-
dave
The A-GPS just means the cell signal can get used to speed up the GPS lock. It doesn't effect the GPS's position accuracy. And yes there is WiFi location also used.
jamone
@jamone Can you define WI-FI. Please look first what AGPS means and don't tell me your home WiFi router can tell you your position on the iPhone. And YES... cell triangulation is used to make a better positioning.
Adrian Pirvulescu
It's commonly known that the iPhone/iPod touch/iPad use the skyhook service that can look up a WiFi's MAC address and then query the web service and find out the approximate location of that hot spot. This is done by mapping WiFi hotspots similar to how Google does street view. Wikipedia "Assisted GPS, generally abbreviated as A-GPS, is a system which can improve the startup performance of a GPS" It helps the GPS lock on faster by giving it a starting location and almanac data and a few other things. It does not mean the GPS uses that only for position. Its just to start faster.
jamone
+3  A: 

well i did some playing around

found some apple documentation that says that [location verticalAccuracy] REQUIRES a device with gps-

so i stuck this code in (abridged) and based on the limited testing i have done, it appears to be doing what i want-

if (([location horizontalAccuracy] > 0) && ([location verticalAccuracy] > 0)){ //report location here }

thanks all for your replies-

cheers, dave-

dave
A: 

Hi there, the inaccurate GPS coordinates are obtained by the iPhone not only via the Wi-Fi or mobile networks, but also the real-coordinates with accuracy level >100 metres.

What I use is to put the line: if (newLocation.horizontalAccuracy < 0 || newLocation.horizontalAccuracy > 50) return;

as the first line in the didUpdateToLocation, to filter out inaccurate coordinates.

The 'location age' i.e. NSTimeInterval locationAge=[locTimestamp timeIntervalSinceNow]; does NOT serve for me to get rid of cached coordinates.

lionfly