Search code examples
androidandroid-servicebattery

Measure apps' battery drainage


There are a lot of questions on here about "My app drains battery! Why?". That is not what I am looking for. I am wondering about how to create an app which can get which apps are draining the most battery.

I know it's possible, because I've seen apps that can do this.


Solution

  • I think you could work it out by CPU usage:

    Take a look at this answer: CPU usage per application in android

    I suspect you would need to continually run a command like this and parse the results into a database, combining previous results to work out a running tally.