Reputation: 20959
In the CLLocationManager
class documentation, I find such explanation for the distanceFilter
property:
This property is used only in conjunction with the standard location services and is not used when monitoring significant location changes.
Can you please explain it?
Upvotes: 3
Views: 1131
Reputation: 73688
In CLLocationManager
, distanceFilter
is used to notify changes when device has moved x meters. Default value is kCLDistanceFilterNone:
all movements are reported.
From the docs
After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected. For example, it might generate a new event when the device becomes associated with a different cell tower. It does not rely on the value in the
distanceFilter
property to generate events.Start standard location services by calling the startUpdatingLocation method. This service is most appropriate for applications that need more fine-grained control over the delivery of location events. Specifically, it takes into account the values in the desiredAccuracy and distanceFilter property to determine when to deliver new events. The precision of the standard location services are needed by navigation applications or any application where high-precision location data or a regular stream of updates is required. However, these services typically require the location-tracking hardware to be enabled for longer periods of time, which can result in higher power usage.
That is why distanceFilter
is used only in conjunction with the standard location services and is not used when monitoring significant location changes eg. desiredAccuracy
or heading
info.
This is because generally it is not really useful to know that a person has moved x meters. However, it is very valuable to know that a person has moved x meters in y heading with z accuracy.
Upvotes: 1
Reputation: 8423
Standard Location Changes: The regular GPS module is used. Battery intensive. If locationManager
is your instance of CLLocationManager
class start the service as follows
[locationManager startUpdatingLocation];
Significant Location Changes: Whenever the radio tower changes. Better for battery. Apple does not say that in the official documentation that is upon changes of radio towers but apparently that is what was said by Apple when the new feature came out.
[locationManager startMonitoringSignificantLocationChanges];
The property distanceFilter
is disregarded by CLLocationManager
if you subscribe to significant location changes.
Upvotes: 0