Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does CLLocationManager distanceFilter do anything to conserve power?

Does the CLLocationManager distanceFilter property do anything to conserve battery life / power usage between making its request at the required distance. I don't think it does, but I just wanted to check that I should still be calling stopUpdatingLocation and not just leaving it running.

I found one answer on here that suggested the phone dialled down its polling (until the desired distance was reached) thus saving power. But on the other hand it seems to hint that even checking the desired distance needs the antennas to be active and as such saves little power.

Currently when I need a locations details I am explicitly doing startUpdatingLocation, checking for a suitable location before sending the stopUpdatingLocation message to the CLLocationManager.

like image 544
fuzzygoat Avatar asked Mar 30 '11 18:03

fuzzygoat


2 Answers

There is nothing directly documented (on the distanceFilter property) to indicate that this is the case. You should definitely be calling stopUpdatingLocation if you care about battery life and giving the user a decent experience. In my own experience developing apps I've never seen any improvement in battery life when using larger values for the distanceFilter - perhaps if it does do anything the gains are just too small to notice.

I believe the point of distanceFilter is not to conserve power, but to allow you to control the number of callbacks you get should your app not require constant streams of location data.

That said, I suspect it does get involved with power requirements. Certainly its related property distanceAccuracy has a definite impact on power management - as per the Apple docs:

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. This can lead to significant power savings.

So I would personally suspect that distanceFilter and distanceAccuracy both affect power in some way. The problem (for you, I guess) is that the measurable effects will vary from device to device, and probably from OS version to OS version. So it's very difficult to quantify in any meaningful way.

like image 72
lxt Avatar answered Sep 29 '22 02:09

lxt


One Apple sample code doc states specifically that setting a larger distanceFilter does not help in conserving power:

http://developer.apple.com/library/ios/#samplecode/LocateMe/Listings/ReadMe_txt.html

... Also, the distanceFilter does not impact the hardware's activity - i.e., there is no savings of power by setting a larger distanceFilter because the hardware continues to acquire measurements. This simply affects whether those measurements are passed on to the location manager's delegate. Power can only be saved by turning off the location manager.

like image 39
Pius Avatar answered Sep 29 '22 02:09

Pius