Reputation: 779
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
Upvotes: 0
Views: 332
Reputation: 11699
The sources that CLLocationManager
uses are not provided. However, you can determine whether GPS is allowed to turn off by setting the desiredAccuracy
property. As the documentation notes, an accuracy of 1 kilometer may have the GPS turn off.
For example, setting the desired accuracy for location events to one kilometer gives the location manager the flexibility to turn off GPS hardware and rely solely on the WiFi or cell radios. Turning off GPS hardware can lead to significant power savings.
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 CLLocation
object. Each CLLocation
object has a property called horizontalAccuracy
. This value is measured in meters. If it is less than 1 kilometer then GPS was probably used.
Upvotes: 1