Reputation: 3
I am developing one application.In that i am getting the location updates using CLLocation Manager.I know when i call start location updating method gps is turn off and when we call stop location updating gps is turn off.But i want to turn off the gps and still i want to get the location updates using cellular towers or wifi.how to do this one.
Upvotes: 0
Views: 123
Reputation: 8337
You can use the desiredAccuracy
property of CLLocationManager
to tell the system how accurate the location needs to be. You don't have control over whether GPS gets turned on or not, but setting the desiredAccuracy
to a lower accuracy consumes less power.
From the CLLocationManager Class Reference:
The receiver does its best to achieve the requested accuracy; however, the actual accuracy is not guaranteed.
You should assign a value to this property that is appropriate for your usage scenario. In other words, if you need the current location only within a few kilometers, you should not specify kCLLocationAccuracyBest for the accuracy. Determining a location with greater accuracy requires more time and more power.
When requesting high-accuracy location data, the initial event delivered by the location service may not have the accuracy you requested. The location service delivers the initial event as quickly as possible. It then continues to determine the location with the accuracy you requested and delivers additional events, as necessary, when that data is available.
Upvotes: 1