Home > Battery Conservation, IOS, Location Services > My app is sucking battery life out of my iPhone – Corelocation

My app is sucking battery life out of my iPhone – Corelocation

Lot of times people point out that they think that Loqlyhttp://bit.ly/e5u4j might be sucking out their battery life because it uses their iPhone’s GPS all the time. Unfortunately, Apple hasn’t done a good job of indicating what the small purple arrow at the top means.

Apple’s official documentation says this about conserving the user’s battery life :

“In iOS 4.0 and later, you can use the significant-change location service to receive location events. This service offers a significant power savings and provides accuracy that is good enough for most applications. It uses the device’s cellular radio to determine the user’s location and report changes in that location, allowing the system to manage power usage much more aggressively than it could otherwise. This service is also capable of waking up an application that is currently suspended or not running in order to deliver new location data. “

Loqly uses the same API which delivers us your location based on cell tower triangulation. i.e We don’t even use your GPS except the first time you download and run our application. The purple arrow just means that an application has accessed your location recently. Which is what Loqly is doing. We don’t keep checking your location. We just tell your IOS device to let us know when you have traveled more than 1/2 mile from your current location. And we leave it to IOS to use cell towers and tell us if you change your location.

Bottomline for developers :

In summary, if as a developer if you want to be conscientious and conserve the user’s battery life, use the significant location changes API “[CLLocationManger startMonitoringSignificantLocationChanges]” instead of [“CLLocationManager startUpdatingLocation]”

Of course, to get the initial “fix” you will HAVE to use CLLocationManager startUpdatingLocation but once you get the location, immediately call stopUpdatingLocation and switch to startMonitoringSignificantLocationChanges.

If you have anything to add to this article or don’t agree with me, kindly leave a comment below.

EDIT: 07/12/2011 – IOS5 beta 3 has some changes specific to location services. Check this out – Basically you will see a gray arrow now if an app has accessed your location in last 24 hours and a purple arrow if it is actively accessing your location.

EDIT: 09/07/2011 – The information in this article is accurate and can be confirmed by Apple’s official docs. But due to the low awareness of the general user, we were still getting constant feedback from users that the arrow should not be there when they close the app. So, we chose to turn off the arrow by simply powering off location services by calling “CLLocationManager::StopUpdatingLocation”. As a result of this the arrow simply stays off all the time even when you are actively using the app. What all you have to do to keep your users Happy 😦

Advertisements
  1. Sasha Dzeletovic
    June 15, 2011 at 6:58 pm

    Nishant,
    Thank you for the excellent insight. Do you have any information how much time does a battery last when using startMonitoringSignificantLocationChanges vs. startUpdatingLocation?

    • June 16, 2011 at 2:51 pm

      Frankly speaking I have not tried it. It will be difficult to come up with a reliable figure because based on your usage patterns that day, the output will change.
      So, the only thing I can think of is to rely on what Apple says. Will see if I can find any numbers published by them on this.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: