How to:‎ > ‎

Connect/send commands to your Android emulator via Telnet

Once you have your App up and running on your android emulator you can connect to the emulator via telnet and send commands in order to simulate events such as sms messaging and GPS coordinate changes. To begin make sure your android emulator is running, then in a console:
telnet localhost 5554
This will connect you to the emulator (note that the port 5554 may change depending on your setup. This port will be in the title of the emulator.)
From here you can type help to list all the possible commands:

    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

You can also ask for further information on each of these commands.

An example:
I want to simulating sending my GPS Coordinate to my emulator:
geo fix -120.66 35.27  

And im in Santa Maria!

NOTE!! When referring to localhost from an App or anything on your android device, localhost refers to the Android device itself (one might normally expect this to refer their computer running the emulator). To address your actual computer (the expected local host) use the address: http://10.0.2.2:8888/
Comments