Reputation: 5740
I'm investigating the possiblity of writing an app for Android/iOS4/both that would use GPS in the background. I found the "Receiving Location Events in the Background" section of the iphone developer documentation, which recommends that I only register for "significant location change" events. I'm not aware of any such capability in the Android SDK, but it still seems like a good idea to do it this way if I can (so as not to drain the battery).
My question is this: has anyone done any sort of benchmarking for this on and iPhone/Android phone? So far, I've seen a lot posts/documentation saying that listening for GPS events in the background is a VERY BAD THING and I should AVOID IT AT ALL COSTS, but I haven't been able to find any numbers for just how much power a background application listening on GPS changes would drain (i.e. % battery drain per time app is running in the background).
This information might be helpful for me (and possibly others too) because I might be able to poll less frequently or even register/unregister my GPS listener based on power drain. Essentially, I could try to put a ceiling on how much battery life my app could drain while in the background.
Thanks!
Upvotes: 2
Views: 1935
Reputation: 207912
The significant location change is present in Android SDK
when you subscribe to get location updates you can add a minTime
and minDistance
that must pass between broadcasts
public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener)
check out the description of the method [here][1]
[1]: http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener)
Upvotes: 4