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 the auth
      auth_token
      command.
      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.
      Enter help, help command, or help-verbose to see a list of console commands and learn about specific commands.

    1. $ telnet localhost 5554
    2. Trying ::1...
    3. telnet: connect to address ::1: Connection refused
    4. Trying 127.0.0.1...
    5. Connected to localhost.
    6. Escape character is '^]'.
    7. Android Console: Authentication required
    8. Android Console: type 'auth <auth_token>' to authenticate
    9. Android Console: you can find your <auth_token> in
    10. '/Users/me/.emulator_console_auth_token'
    11. OK
    12. auth 123456789ABCdefZ
    13. OK
    14. help-verbose
    15. Android console command help:
    16.  
    17. help|h|? print a list of commands
    18. help-verbose print a list of cmmands with descriptions
    19. ping check if the emulator is alive
    20. event simulate hardware events
    21. geo Geo-location commands
    22. gsm GSM related commands
    23. cdma CDMA related commands
    24. crash crash the emulator instance
    25. crash-on-exit simulate crash on exit for the emulator instance
    26. kill kill the emulator instance
    27. network manage network settings
    28. power power related commands
    29. quit|exit quit control session
    30. redir manage port redirections
    31. sms SMS related commands
    32. sensor manage emulator sensors
    33. finger manage emulator fingerprint
    34. debug control the emulator debug output tags
    35. rotate rotate the screen by 90 degrees
    36.  
    37. try 'help <command>' for command-specific help
    38. OK
    39. exit
    40. 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.