androidadbbatterydumpsys

Is it possible to fetch current battery level via ADB shell command?


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


Solution

  • For linux/macOS:

     adb shell dumpsys battery | grep level
    

    For Windows:

    adb shell dumpsys battery | findstr /r /c:level