Get location on iphone ONLY from GPS - no Wi-Fi network

I am creating an application that uses location -

everything works smoothly, except for one -

When I get home, my iphone connects to a local Wi-Fi network and instead of getting its location using GPS on the phone, it tries to get it by finding out where my Wi-Fi network is connected if I disconnect my Wi-Fi saves exact location point -

as soon as my phone is connected to my wifi network, it starts telling me that my location is a few kilometers from my actual point.

I would like my application NOT to use a Wi-Fi network to try to get my location -

is there a way as well. tell me if the location point was obtained from GPS, so I can ignore the locations received from the Wi-Fi network. b. location stop services switching to wifi for location

+7
iphone geolocation gps
source share
6 answers

Well, I played a little

Apple documentation found that says [location verticalAccuracy] REQUIRES a gps device.

So, I am stuck in this code (abbreviated) and based on the limited testing that I have done, it seems to do what I want:

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

Thank you all for your answers.

+5
source share

Aside from asking the user to turn off their Wi-Fi, there is no documented way to get the location manager to use GPS via Wi-Fi. This may be possible using the private API, but it will also cause you to reject it from the App Store.

+2
source share

You can set cLLocationAccuracy.desiredAccuracy = kCLLocationAccuracyBest and see if that does it. He should try to limit the use of GPS, however this is not 100% guaranteed.

+1
source share

The reason he uses WIFI at home is because he cannot immediately see GPS satellites in space - instead of not giving you any location data, he uses the next best available source.

+1
source share

Inaccurate GPS coordinates were received by iPhone not only via Wi-Fi or mobile networks, but also with real coordinates with an accuracy level> 100 meters.

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

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

"Place Age", i.e. NSTimeInterval locationAge=[locTimestamp timeIntervalSinceNow]; NOT serving me to get rid of cached coordinates.

0
source share

A-GPS = triangulation of the GPS tower + cell. No WIFI positioning.

-5
source share

All Articles