Testing Battery Usage

There is a new tool which comes with Android 5.0.

You can run

adb shell dumpsys batterystats > dump.txt

To get the full battery dump of you device. You also can add some options like --unplugged (only output data since last unplugged) or --charged (only output data since last charged). You can also add a packagename to get informations for this package/app only:

adb shell dumpsys batterystats --unplugged your.package.name > dump.txt

The part > dump.txt put everything into a file (maybe just works on Windows, not sure. But you can just leave it away, the dump will be printed right in the console where you can copy it and put it in a file).

This works just if you have a device with Android 5.x.
If you have a device with a lower level you can try to use

adb shell bugreport > bugreport.txt

But this file will be very very big. (~8mb+)

After creating this file you can use the Historian Tool of Google

To use it you have to install Python 2.7.9 and run following command

python /path/to/historian.py dump.txt > battery.html

This will create a battery.html file where you can see the data in a more usefull formatting.

Last thing: If you want to reset the stats of the battery dump just call

adb shell dumpsys batterystats --reset

(just works with Android 5.x)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)