Reputation: 1403
Suppose If change the battery level to any desired value(say from current 50 to 20)
adb shell dumpsys battery set level 20
Now I want adb command to fetch the current battery level(ie 20).
With the below command I can reset to original value(50 in our example)
adb shell dumpsys battery reset
Now again I want fetch the current current charge level via adb command
Upvotes: 0
Views: 2833
Reputation: 1
You can read a file where level/capacity located
The file is located in /sys/class/power_supply/battery/capacity
In Linux, MacOS and Windows:
adb shell cat /sys/class/power_supply/battery/capacity
Upvotes: 0
Reputation: 1761
For linux/macOS:
adb shell dumpsys battery | grep level
For Windows:
adb shell dumpsys battery | findstr /r /c:level
Upvotes: 2