Simulating a power cable being connected to the emulator requires two separate events,
power status charging
and
power ac on
To interact with the android emulator you telnet into it to get an interactive shell - which enables you to send all sorts of commands to it. Typing in commands like the above over and over to simulate a power cable being connected is annoying at best.
On OSX I have written the following python scripts to enable the condition(s) I want with a single command.
#!/usr/bin/python
import telnetlib
tn = telnetlib.Telnet("localhost",5554)
tn.write("power status charging\r\n")
tn.write("power ac on\r\n")
Save that guy as "power_on.py" in your android-sdk/platform-tools directory - and any time you want to simulate the power cable being connected simply type:
power_on.py
... and for an added bonus here is my power_off script:
#!/usr/bin/python
import telnetlib
tn = telnetlib.Telnet("localhost",5554)
tn.write("power status discharging\r\n")
tn.write("power ac off\r\n")