BatteryStats and Battery Historian in Android

While developing android apps, it is our duty as developers to make sure that our apps are good citizens in terms of Battery consumption. Android framework has two main tools, BatteryStats and Battery Historian.  

First will explain BatteryStats and Battery Historian.

BatteryStats Batterystats is a tool to dump the battery data of the device to the development machine.

BatteryHistorian Battery Historian converts the report from batterystats to a HTML visualization that we can see in the browser.

Through these tools we can identify
  • where and how processes are drawing the battery & 
  • identifying tasks which can be deferred or even removed to improve the battery life.

Steps to install BatteryHistorian are,

1. Install docker software from here

2. Git clone the repo from here

3. Then run the command in terminal

docker run -d -p 9999:9999 bhaavan/battery-historian

4. Type in address bar of the browser,


5. Then run the command in terminal

adb bugreport > bugreport.txt

6. Then in browser select the bug report file and submit, you can see the bug report now.

That's it.
You are done.

Happy Coding
Team Androidians


Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android