Requirement:-
1. Android ADB
2. Download the open source Battery Historian python script from GitHub.
3. Unzip the file to extract the Battery Historian folder. Inside the folder, find the historian.py file and move it to the Android SDK platform-tools folder.
Steps:-
1. Connect your mobile device to the computer.
2. On your computer, open a terminal window.
3. Change to the directory where you have saved historian.py.
D:\Android\sdk\platform-tools>
4. Shut down your running adb server.
>adb kill-server
5. Restart your adb server.
D:\Android\sdk\platform-tools>adb start-server
6. Check for connected devices.
D:\Android\sdk\platform-tools>adb devices
7. Reset battery data gathering.
D:\Android\sdk\platform-tools>adb shell dumpsys batterystats --reset
Output: - Battery Stats reset
Note : - Resetting erases old battery collection data; otherwise, the output will be huge.
9. Disconnect your device from your computer so that you are only drawing current from
the device's battery.
the device's battery.
10.Play with your app for short time.
11.Reconnect your phone to your computer and make sure your phone is recognized.
D:\Android\sdk\platform-tools>adb devices
12.Dump all the battery data. This can take a while:
D:\Android\sdk\platform-tools>adb shell dumpsys batterystats > batterystats.txt
Output:- "Failed to get bug report's version, which is only available on devices
running Android 7.0 or later. Trying a plain-text bug report instead".
You will get this message if you are running Android version 5 or 6.
running Android 7.0 or later. Trying a plain-text bug report instead".
You will get this message if you are running Android version 5 or 6.
13.Create HTML version of the data dump for Battery Historian.
D:\Android\sdk\platform-tools>historian.py bugreport.txt>Vijayblogappbatterystats.html
14.Go to writable directory folder i.e. Android SDK platform-tools and find
"Vijayblogappbatterystats.html"
Original Source:- https://developer.android.com/studio/profile/battery-historian.html
Comments
Post a Comment