Reputation: 3316
I am developing a location based android application which requires to retrieve location continuously in background.
This means if user keeps notification on, the service will go on requesting location updates. My biggest concern right now is battery drain. I know I must stop requesting updates at some point but my app needs receiving location continuously in background. Can anyone tell me how much average battery location updates may drain when I am using NETWORK_PROVIDER and requesting updates at an interval of 5 mins?
Also should I use LocationClient instead of LocationManager in order to improve performance? Or will it be ok if I continue with LocationManager.
It would really be great if someone could provide me a suggestion on how to efficiently receive location updates in app which continuously requires location data.
Upvotes: 0
Views: 884
Reputation: 1967
Requesting location updates using NETWORK_PROVIDER
and updating the location every 5 mins is just okay. But the accuracy of the location is degraded if you compare it with GPS_PROVIDER
but then again gps needs more power. As a personal experience that I had yesterday, my GPS was constantly on for 3 hours tracking my location every 10 seconds, I had a battery drain of 20% in that time using Nexus 4. Rest you can choose fro yourself if it is acceptable to you or not.
But as others have mentioned, using FusedLocation Provider that is LocationClient
is the best alternative to the accuracy vs battery drain problem.
Upvotes: 0
Reputation: 2066
LocationClient is part of Google Play Services and I believe Location Client is the more efficient in getting the location with minimal energy(battery drain) with greater accuracy.
And also refer APIs :) http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html
http://developer.android.com/reference/android/location/LocationManager.html
Upvotes: 1
Reputation: 3399
You have to remember that LocationClient is part of Google Play Services, so it's only available on devices whose platform includes Google Play Store. Some devices may be using a non-standard version of Android, and you won't have access to LocationClient.
Upvotes: 0