What is active GPS effect on mobile devices battery life? - iphone

How much does active GPS drain the battery? Without the overhead of the gps navigator software. s
ay I want to sample the gps every 2 minutes and save it to a file. how much battery power will that cost me?
Will I get 10% shorter life? 20%? ..?

I think this can't be answered that easy without measuring it. But you could measure it. Just try how long it takes to empty the whole battery. Once with GPS and once without.

It will be noticeable by the user. You definitely don't want to do this kind of thing unless it is a feature the user is explicitly aware of and able to clearly turn on and off depending on whether at any particular time they think that feature is worth the impact on their battery.

On my HTC Desire, RunKeeper with GPS always active, battery was near to down after about 5 hours of usage (in forrest).
But the screen was down while it was running, 2 hours of reading pdf drains about 40-50% of battery, so GPS working in background drains about same or less energy than screen active.
When you turn the GPS on, you must wait, depending on where you are, before you get the read, so if you want to save position every 2 minutes, I think GPS will be on about 25%-50% of time. 10 hours of work in background would be max in that case...
Maybe the question about increasing battery life on Windows Mobile using GPS will give some hints, since the device used in test was manufactured by HTC, which is one of the most popular manufacturer of Android Devices nowadays...

Related

Does low battery level stop the location service or make it fail to fetch the location?

Some of my users ran into an issue where they couldn't fetch the location using Location Service.
In the screenshots they sent me, i noticed that the battery level was really low, like 2-5%.
My question is, does iOS stop the location service when the device is running out of battery?
Thanks
Enabling Low Power Mode (the one that turns the battery icon yellow) does several things to reduce the battery usage of your device. This probably includes the accuracy and refresh rate of the GPS.
If you're requesting a location with a high level of accuracy, the system might either take too long and timeout or just decide not to fulfill that request since the hit on the battery would be too much.
does iOS stop the location service when the device is running out of battery
It certainly might. The GPS is one of the highest power draws of all the sensors. Turning it off would make a lot sense. See also Apple's own statements about low power mode:
https://support.apple.com/en-us/HT205234
Note that if this is the case, it would hardly be an issue with your app. Your app might use a lot of battery, which could be a problem; but if location services itself is affected, all map/navigation apps would be affected.

CLLocationManager geo-fencing/startMonitoringForRegion: vs. startMonitoringForSignificantLocationChanges: vs. 10-minute startUpdating calls

I am trying to set up an app that will be able to check people's locations in the background, see if they are at a given location, and send a ping to a server if they are. We do not want to drain the energy of our users, so we are attempting to figure out the best solution.
I've done substantial reading and I have not found very much information on these methods. I'll go through the pros and cons as I understand them right now
startMonitoringForSignificantChanges
Description: Based off of wi-fi and cell tower changes the system wakes up the app.
Docs:
Apps can expect a notification as soon as the device moves 500 meters
or more from its previous notification. It should not expect
notifications more frequently than once every five minutes. If the
device is able to retrieve data from the network, the location manager
is much more likely to deliver notifications in a timely manner.
Pros:
Most battery efficient
Cons:
Dependent on wi-fi/cell tower changes
Can only assume that this will be called every 200m to 2km (if not more in certain areas)
More on accuracy
Thus, inconsistent and imprecise
10-minute start-updating or "n-minute updating":
Description: This basically asks the app for more time, when that extra time is about to expire, it calls [self.locationManager startUpdating], grabs the location and extends the background thread for 10 more minutes.
Pros:
Consistent
Can be as accurate as you want it to be as consistently as you
want it
Cons:
Has to do a call every ten minutes or less to keep the app running in the
background (ie n can't be greater than 10 for the calls)
Questions:
What effect does this have on the battery? Does waking up the GPS and shutting it off hurt the battery more? I couldn't imagine running a brief location check in the background would drain the battery that much... but then again, I don't know what goes into powering up the GPS and getting a usable signal.
startMonitoringForRegion (geo-fencing):
Simply put, your app gets woken up when you enter into a pre-defined region. This is the oddball of them, it is more recent and there is less documentation on it. I can't find a good description on how the "system monitors" the boundary crossing. For all I know it is some really smart algorithm, or they are constantly pinging the GPS which would make it less effective than the other methods for doing this.
Pros:
Simple implementation
Managed by the system so you don't have to invent your own ad hoc geo-fences Only triggers on boundary crossing... no unnecessary data to just throw out in exchange for a battery hit
Thus, should be the best for this sort of thing, accurate, managed by the system
Cons:
People question its effectiveness
Huge conflicts on whether or not it is good for battery life or if it
drains battery life terribly.
How is the system monitoring this!?
Basically, indeterminate behavior.
I guess my question boils down to how does startMonitoringForRegion: compare to these other methods of testing user location in the background when it comes to battery life, consistency, and precision. Has anyone thoroughly tested this? Or used it in their app and gotten at least some feedback? Likely, for my purposes, the trade-off is between geo-fencing and the 10 minute update method. (Also given what Apple has publicly said about iOS7 there will be some background tasks... will this change the calculus for the trade-off between these two methods?) Does anyone have an idea of how these two compare?
Thanks so much! Looking forward to seeing if we can get to the bottom of how to compare these methods.
I've been working on vehicle tracking using GPS for 2 years. Learned a lot the hard way... In my experience startMonitoringForRegion or Geo-fencing depends upon cell change events, didEnter or didExit events doesn't fire up until there is a cell/wifi change event. So it doesn't make any difference w.r.t battery consumption. However it does extra computation which depends on how many regions currently are being monitored. Even Apple's Reminder app doesn't give good results for location based reminders because it uses geo-fencing.
The other approach starting GPS for n minutes after each m-minutes is good option, it should not affect the battery life, if done wisely. What exactly effect the battery is constant GPS activation in high precision mode. Like for instance If you enable GPS with kCLLocationAccuracyBest and distance-filter = 0, you can literally observe battery drainage and soon your device will also start getting hotter.
If I was you, I would go for activating GPS after every 10 minutes for 5 sec with kCLLocationAccuracyBest (or may kCLLocationAccuracyNearestTenMeters to use less battery, if accuracy is not that much important) and distance-filter = 5 (meters). Battery consumption in this case will be unnoticeable. You can play around with similar settings which can address your specific case and finally find out what is best you.
BTW: iPhone uses AGPS, A-GPS additionally uses network resources to locate and use the satellites in poor signal conditions. So, when you do startUpdatingLocation it will also use nearby cell tower information. see http://en.wikipedia.org/wiki/Assisted_GPS

How to reduce iPhone battery consumption while using GPS

I am using GPS to actually monitor if I have entered a regions (radius 100 m).
I am using a hybrid of significantLocationChanges and hardware GPS, startUpdatingLocation.
As significantLocationChanges are not as accurate as I require I am using them only to check if I have entered a outer circle of X m. Then I use hardware GPS to check if the user enters an inner circle (100m).
The problem with it is that battery is getting drained pretty quickly, can anyone help me out.
I was concerned about the same issue and today i have made a simple test with MotionX on iPhone 4 , covering the distance of 15 km in 4 hours, with frequent audio coaching, taking photos, saving waypoints, checking the position on map and tracking the route. After 4 hours i had still 50% of battery power. Which shows that it would probably covered 8 hours route. Good enough, or?
So there must be some ways of wise GPS management, which MotionX knows (they say it proudly in their tech. description)
Here's a preview of a nice read (High Performance iOS Apps):
https://www.safaribooksonline.com/library/view/high-performance-ios/9781491910993/ch04.html
You'll see it covers battery usage in general, so search for "gps" for specifics. I use this as a reference so I don't forget any of it's tips. Enjoy the read :)

Time based GPS location in background (iphone)

I want to create an (game based) iPhone application which sends your GPS location on a specific time (like 3-5 times a day) to a server. I found an apple page explaining some functionality to run in the background like location, music and VOIP.
I need the GPS to be accurate on the meter.
Can someone help me with a small example?
It really depends on your usage of the location. If you monitor actively, kiss the battery of your user goodbye. Very detailed accuracy, even bigger hit to battery. The backgrounding of location is all or nothing as far as accuracy goes.
Less hit, less accuracy is -startMonitoringForSignificantLocationChange. May not be accurate enough for you.
Better depending on usage, region monitoring. Triggers event on entry or exit of defined region.
You don't have the benefit of accuracy and timed location based events. You can do it, but is going to require a lot more effort on your end.
While this is untested, I am planning an app with a similar need. My solution is that on a significant location change, the app will determine what interval exists between the update timestamp, and when I care to know the users location (5pm for instance). If that's below some threshold, it will go into startUpdatingLocation mode (full power, battery draining, which is why that threshold is important) and then, on each location update, check if that target time has passed. if SO, send the update to your server, and go back to monitoring for significant changes. The catch is that if it still requires some movement to trigger the significant change update...so it isn't a perfectly reliable solution, but it may work depending on how you're using the data
You can't "schedule background work". iOS doesn't allow it.
The solution is to set yourself up for notification on significant change (which is some hit to the battery, but it's not horrible), and then only DO anything with that at occasional intervals.

How accurate is the iPhone 3G GPS for measuring Distances between two CLLocation?

In my application the user will hold the iPhone and walk in straight line, iPhone will alert the user every 2 meters to make lux measurements and record them. Is the GPS on the iPhone accurate enough for such task? (given that the place is the runway of the airport and should have clear reception of GPS satellites signals...)
No, you won't get that good a fix. 2m is about the limit of GPS and that usually requires significant time without moving. 10m seems to be what you should be able to get, though I've heard worse and (obviously Ole above) better.
The best reported GPS accuracy I ever got was about 7 m. Why don't you build a simple sample app and test it for yourself? It should only take a few minutes.