Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLLocationmanager: Save battery

My new "app in progress" uses an instance of CLLocationManager for several purposes. To make the app as battery-friendly as possible, the location services should be activated only if needed, and deactivated immediately when the data refresh is done. For my purpose it's perfectly enough to fetch the location data only once in 10 seconds. (Haven't yet decided the exact interval length).

My question is, which is the most battery-efficient method of "turning off the Location services"? Is it sufficient to just use the "stopUpdatingLocation" method and keep the CLLocationManager himself in memory, or am I required to release the entire instance, and allocate a new one before the next refresh?

like image 497
mch Avatar asked May 06 '12 11:05

mch


1 Answers

I agree with the other answers that stopUpdatingLocation in combination with the distanceFilter and desiredAccuracy is the way to go. Note that when the desired accuracy is in the scope of kilometres, the location manager might not even have to fire up the GPS.

Similarly, depending on what you use it for, have a look at region monitoring and significant location updates since those are more battery friendly.

Related: Location Awareness Programming Guide - Tips for Conserving Battery Power

like image 160
Adrian Schönig Avatar answered Nov 29 '22 06:11

Adrian Schönig