Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get information about android battery usage by application

How can I get battery usage per application in Android.

I need to know % of battery spent by application.

Is it possible using SDK?

What I need is the information that's available on an Android device under "Settings>About phone>Battery use", but for specific applications

Thanks

like image 788
jlopes Avatar asked Sep 22 '10 14:09

jlopes


People also ask

How can I tell which app is draining my phone Battery?

Settings > Battery > Usage details Open Settings and tap on the Battery option. Next select Battery Usage and you'll be given a breakdown of all the apps that are draining your power, with the most-hungry ones at the top. Some phones will tell you how long each app has been actively used – others won't.


1 Answers

The project isn't complete by any stretch of the imagination, but I created an application framework (kinda...that was the goal, it's not there yet) to do just this. Check out http://syspower.googlecode.com. You won't be able to get the percentage by application unless you calculate the usage for all applications but you can get quantitative values for power consumption. You can obviously then use those numbers to calculate a percentage. Also, you should note that the power consumption API is private and in order to access it, I had to use a number of reflective calls to access private and hidden data members. Given that, it may or may not work with all Android versions (I've tested it with 1.6-2.1). I basically had to reverse engineer the FuelGuage app from the open source repository.

like image 112
Chris Thompson Avatar answered Oct 17 '22 20:10

Chris Thompson