I need to implement location-based service. I don't need fine location, so no GPS is needed.
Easiest would be to start listening for locations updates at app start, and leave it ON:
mLocationMgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 100, mPendingIntent);
Since I don't need much accuracy, I set max frequency of updates, to 10s, and 100m instead of default 0, 0.
When we think location, we think battery drain, but I guess this is a shortcut and that only GPS really drains the battery. I think that such a use of network provider wouldn't drain the battery. Any thoughts?
According to research, GPS signal strength can play a major role in depleting battery life as well. Under a good signal strength, GPS apps will shorten the battery's life less - by 13%. If your remote workers are in an area with weak signal strength, the battery can deplete up to 38%.
The biggest reason always-on location apps drain your battery is because it takes power for GPS to get an accurate read on your location.
GPS is expensive because it is a very slow communication channel—you need to communicate with three or four satellites for an extended duration at 50 bits per second ... Mobile devices such as Android and the iPhone achieve their battery life largely because they can aggressively and quickly enter into and exit from ...
Your 100m distance filter will do little for you from a battery drain standpoint. That will only control how many times your PendingIntent
gets executed due to fixes.
Your 10 second time value might be used by the OS to control power usage, but there is no guarantee. And, with that low of a value, it seems highly unlikely that it would be used. Every hour, maybe, but not every 10 seconds.
The bigger thing is that you will be needing to keep the CPU powered on all the time. And, since you're using the PendingIntent
flavor of requestLocationUpdates()
, I am guessing that you plan on collecting data for a long time.
If you only have COARSE
permission, Android hopefully eschews the WiFi hotspot proximity detection, which will save a bit of power.
On the whole, the network provider will consume less power than will the GPS provider. "Less" is a far cry from "little". On a Nexus-class Android device, GPS + CPU gives me a few hours battery life (as determined by using Google Navigation). I would expect network provider + CPU to last a few hours longer, but that's about it, because the CPU is a fairly significant battery drain in its own right.
My bigger concern is:
Easiest would be to start listening for locations updates at app start, and leave it ON
This sounds like you aren't actually planning on removing your location updates. This is a really bad idea, with any sort of provider (except maybe the passive provider). Please have a more concrete plan for when you are registering and removing the updates. In particular, make sure the user has the ability to control when you are consuming battery to this degree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With