How can I change the battery level (from 50% to 70% and not charging) on emulator in Windows OS? There are some guides, but all of them are for Ubuntu.
3 Answers
Windows supports telnet
from the command prompt, at least on XP and Vista. If you do not find this program on other Windows versions, you can perhaps install PuTTY.
Then, you telnet into the emulator the same way that you would on any other development OS:
telnet localhost 5554
where 5554 is the port number given in the title bar of your emulator window.
From there, it's how the rest of the instructions that you have read describe it. For example, to set the
power to 70%, execute the power capacity 70
command in the telnet session. There are other power
subcommands outlined in the documentation.

- 986,068
- 189
- 2,389
- 2,491
-
Thanks, I've enabled telnet, and got it working. The only difference is that when you're in telnet, you must use `o localhost 5554` to connect to emulator. – domen Aug 15 '13 at 12:48
-
@CommonsWare The ANdroid emulator crashes when executing power capacity 70 – Balaji Sabdhar M Mar 21 '14 at 10:37
-
There is another catch to it...if you accidentally misspell the command and retype it, you get a "bad-command" error. Happened with me several times, but finally I figured it out. – BajajG Feb 19 '15 at 10:33
If you are using a remote emulator, like android x86 you can use the following:
adb connect
adb shell dumpsys battery set level 90

- 636
- 8
- 17
I'm using Google's Android emulator with Android Studio on a Windows 10 machine. It is very simple to change the battery status or battery's charging level from user interface(UI) of the emulator. Only catch is that the relevant setting is not present on the main tool bar. It is hidden. Here are the steps to reach it:
Click on three dots at the bottom of the tool bar (Refer screenshot) to open extended controls window:
On the extended controls window, click Battery in left navigation bar (Refer screenshot).
Now in the right pane, you can see all the settings related to battery of the emulator.
Battery status field is a drop down list with below values:
- Unknown
- Charging
- Discharging
- Not charging
- Full
You can set it to any value of your choice while debugging an app.

- 24,161
- 21
- 159
- 240