Vlad
Vlad

Reputation: 191

Is it possible to receive an SMS from Android emulator?

I was wondering if there is a way to receive an SMS from Android emulator, perhaps on a TCP port. I know it's possible to send SMS to emulator by opening a TCP socket on the emulator port and using "send sms" command, but is it also possible to receive an SMS this way?

I'll elaborate - I have a java application running on a Tomcat server. I also have an Android emulator running on the same machine. I can send SMS messages from the application to the emulator using the "sms send" command. Can I also receive SMS messages in some way?

Upvotes: 19

Views: 45771

Answers (7)

Jesse Caron
Jesse Caron

Reputation: 1

I assume that this is experimental - where you have control of both ends of the exchange yourself, rather than trying to actually use an emulator in place of a smart phone for communicating WITH OTHERS via SMS. Because numerous other sources say that the latter simply isn't possible, due to how the data is transferred: through cell systems, not over "the internet" per se.

Upvotes: 0

Rasoul Miri
Rasoul Miri

Reputation: 12222

in terminal you can use this

adb emu sms send [from] [message]


adb emu sms send 12345 hiiiiii
adb emu sms send 09129009090 Hi

Upvotes: 3

Sankar Ganesh PMP
Sankar Ganesh PMP

Reputation: 12027

Friend, refer to this answer provided in a blog (with additional info from authentication token does not match ~/.emulator_console_auth_token)

Just connect the emulator using telnet and there we can emulate SMS. Below are the steps to emulate SMS:

Step 1: Start the emulator (with any desired options). Open a new terminal / command shell and type :

adb devices

Note the number after emulator (emulator-5554). This is the port number.

Step 2: Connect to the console using the telnet command:

telnet localhost 5554 

Step 3: You will then need to authenticate the session. Find the auth_token in ~/.emulator_console_auth_token and copy the text in the file. Return to the telnet console and enter:

auth {contents_of_token_file}

Step 4: After you have authenticated the shell you can emulate SMS with the command:

sms send <phonesender> <textmessage>

For More Info Refer to this link

If you send SMS from the emulator, see this http://mobiforge.com/developing/story/sms-messaging-android

Upvotes: 9

izbrannick
izbrannick

Reputation: 359

UPDATE : follow video tutorial on this link: https://developer.android.com/studio/run/emulator.html#console

  DDMS -> Emulator Control

enter image description here It been a while, but never late to learn.

Upvotes: 5

Maksim Dmitriev
Maksim Dmitriev

Reputation: 6209

telnet localhost <port number> didn't work for me.

This worked for me:

Run an emulator and click "More." That's three horizontal dots to the right of the emulator window. enter image description here

Then click "Phone". enter image description here

Type a phone number from which you'd like to receive a text and the text. Press "Send message" enter image description here

Now you see your message.

enter image description here


Source: https://developer.android.com/studio/run/emulator.html#console, the table "Working with the Extended Controls, Settings, and Help," the row "Phone."

Upvotes: 25

grytrn
grytrn

Reputation: 423

No it is not possible.

first you connect to your emulator via telnet with following command:

telnet localhost <console-port>

then you can query for help like this, to see all available commands for sms:

sms help

here is the list with all commands:

available sub-commands:
send             send inbound SMS text message
pdu              send inbound SMS PDU

finally you can go and visit android developer page for extensive information about emulator console here:

http://developer.android.com/tools/devices/emulator.html#console

Upvotes: 2

NickT
NickT

Reputation: 23873

Start two emulators, first will be 5554, second will be 5556. Send a text message using the built in messaging app from 5554 to 5556 by typing '5556' as the telephone number.

(You will need to have created two different AVDs first, so that you can use one for 5554 and the other for 5556)

Upvotes: 1

Related Questions