I’m building a little prototype app to test Location Services. My app uses both -startUpdatingLocation and -startMonitoringSignificantLocationChanges (for background processing).
In both cases, I’m trying to send a json object to a server with the location data I get, but I’d like to be able to also send some sort of identifier so I can determine which mode of location service was used to acquire the data (GPS, wifi, tower or at least if it was through one of the two services above.
I’m setting up my CLLocationManager in the AppDelegate if that makes any difference.
Thanks
The sources that
CLLocationManageruses are not provided. However, you can determine whether GPS is allowed to turn off by setting thedesiredAccuracyproperty. As the documentation notes, an accuracy of 1 kilometer may have the GPS turn off.You don’t exactly control the GPS because other apps may be requesting a greater accuracy in the background.
You can roughly guess what was used for determining your location by examining your
CLLocationobject. EachCLLocationobject has a property calledhorizontalAccuracy. This value is measured in meters. If it is less than 1 kilometer then GPS was probably used.