例如,可以使用控制台動態管理端口重定向(port redirections)和網絡特徵和模擬電話的事件.
要使用控制台以輸入命令, 可以使用telnet連接到主機的端口號(port number), 使用這個命令:
telnet localhost <console-port>
其中<console-port>是仿真器的端口號(port number), 即仿真器上顯示的數字(例如: 5554).
下面的例子,是使用Ubuntu Linux的Terminal, 使用telnet連接到仿真器控制台, 改動仿真器的電池狀態.
$ telnet localhost 5554
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
help
Android console command help:
help|h|? print a list of commands
event simulate hardware events
geo Geo-location commands
gsm GSM related commands
kill kill the emulator instance
network manage network settings
power power related commands
quit|exit quit control session
redir manage port redirections
sms SMS related commands
avd manager virtual device state
window manage emulator window
try 'help <command>' for command-specific help
OK
power display
AC: online
status: Charging
health: Good
present: true
capacity: 50
OK
power ac off
OK
power status discharging
OK
power
allows to change battery and AC power status
available sub-commands:
display display battery and charger state
ac set AC charging state
status set battery status
present set battery present state
health set battery health state
capacity set battery capacity state
KO: missing sub-command
power capacity 25
OK
power display
AC: offline
status: Discharging
health: Good
present: true
capacity: 25
OK
沒有留言:
發佈留言