Send Emulator console commands
The following commands require that you already have an emulator running. For more information about running an emulator, see and Start the Emulator from the Command Line.
To access the console and enter commands, from a terminal window, use toconnect to theconsole port and provide your authentication token. Each time the console displaysOK, it's ready to accept commands. It doesn't have a typical prompt.
To connect to the console of a running virtual device:
- Open a terminal window and enter the following command:
Note: The emulator listens for connections on ports 5554 to 5585 and accepts connections from localhost only.
- After the console displays
OK
, enter theauth
command.
auth_token
Before you can enter , the emulator console requires authentication.auth_token
must match the contents of the.emulator_console_auth_token
file in your home directory.
If that file doesn't exist, the telnet localhost console-port
command creates the file, which contains a randomly generated authentication token. To disable authentication, delete the token from the .emulator_console_auth_token
file or create an empty file if it doesn't exist.
After you're connected to the console, enter console commands.
Enterhelp
,help command
, orhelp-verbose
to see a list of console commands and learn about specific commands.
- $ telnet localhost 5554
- Trying ::1...
- telnet: connect to address ::1: Connection refused
- Trying 127.0.0.1...
- Connected to localhost.
- Escape character is '^]'.
- Android Console: Authentication required
- Android Console: type 'auth <auth_token>' to authenticate
- Android Console: you can find your <auth_token> in
- '/Users/me/.emulator_console_auth_token'
- OK
- auth 123456789ABCdefZ
- OK
- help-verbose
- Android console command help:
- help|h|? print a list of commands
- help-verbose print a list of cmmands with descriptions
- ping check if the emulator is alive
- event simulate hardware events
- geo Geo-location commands
- gsm GSM related commands
- cdma CDMA related commands
- crash crash the emulator instance
- crash-on-exit simulate crash on exit for the emulator instance
- 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
- sensor manage emulator sensors
- finger manage emulator fingerprint
- debug control the emulator debug output tags
- rotate rotate the screen by 90 degrees
- try 'help <command>' for command-specific help
- OK
- exit
- Connection closed by foreign host.
Emulator command reference
The following table describes the emulator console commands with their parameters and values.
Table 1. Emulator console commands
Figure 1. Fingerprint authentication screen.
To simulate and validate fingerprint authentication, follow these steps:
- If you don't yet have a fingerprint ID, enroll a new fingerprint in the emulator by selecting Settings > Security > Fingerprint and following the enrollment instructions.
- Set up your app to accept . After you perform this setup, your device displays the fingerprint authentication screen.
- Then, enter the
finger remove
command to simulate finger removal.
Your app should respond as if a user touched and then removed their finger from the fingerprint sensor.