1

In one of my app, which tracks user location continuosly while user is moving, I am using "Activity Recognition Api" and "FusedLocation Api" for detecting the user movements and then based on those movements capturing the location points.

Everything is working fine and locations are recording and showing correctly, but the problem is with battery consumption. My app is consuming high battery(if I use the app for 30 mins it is consuming around 5% of the battery).

These are the properties I have set for location updates:

mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(0); 

If I setInterval as some value(example : 2000), then the track path is not appearing good i.e there are many overlaps and zig-zags, so I have taken "0".

So my problem is with battery consumption, if anyone have the best way to implement the requirement with more battery efficiency, can you please help me.

Michael
  • 57,169
  • 9
  • 80
  • 125
Renadh
  • 133
  • 8

1 Answers1

0

Here is a, probably, relative to your question.

I'm a little confused, because on android official web-site there are a lot of appropriate information how to optimize battery consumption in guide and in documentation. If you've made everything without mistakes - you've did your best.

If your app is a sport-tracker then 5% in 0.5 hour is not so bad. But note, that update frequency depend not only on that value in setInterval() method but on hardware also. And 0 value can be normal for your phone, and really bad for another models with higher frequency.(See screenshot of documentation)doc for setInterval() method

Also it can be a little bugs with your battery level analyzer, or your battery is not so well. For example my phone quickly go down across 10-1% of battery level. But with last percent I can use it for roughly 20-30 mins.

Community
  • 1
  • 1
RevakoOA
  • 601
  • 1
  • 9
  • 20