开发者

Simulating SMS on Android Devices when developing

Is there a way to se开发者_StackOverflow社区nd an SMS from te DDMS in Eclipse to my Android phone. The emulator control is disabled when I'm running my physical phone. I can only sent a SMS to the emulator.


The following few steps should get you up into simulating an incoming sms in an Android Emulator.

Requirements:

1.Make sure that you have the telnet client in you PC whether it is Windows or Linux.Google around on how to install one if it is not already installed on your PC.

Steps To Emulating an incoming sms

(a) open you CMD prompt and Enter the command:

telnet

For now I am Demonstrating using Windows 7 ,so you will get

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet>

(b)Assuming that your Emulator is already started.And while still on the CMD,type:

 o localhost 5554

this should open a connection to the emulator.

(c)To Emulate an incoming sms from a number say 0123456 type:

sms send 0123456 Your Message

You should be able to get the message in your android emulator inbox.Thats all Folks.


The newest way in 2019:

I hope in 2020 we'll be able to simulate SMS on real devices (if it's legal)

Simulating SMS on Android Devices when developing


Yeah it doesn't seem like it is possible. With the emulator you can do:

telnet localhost 5554
sms send +12345 A quick brown fox.

But if you try it with a real phone (well I tried a Galaxy S2) it just closes the connection. Of course it's always possible Samsung screwed up the code somewhere, but as common as that is, I think in this case the functionality is probably disabled for non-debug ROM builds.


I am not sure about what versions of android or adb support this you can try

adb emu sms send [from] [message]

so for example

adb emu sms send "+1555....." "Your message goes here....."

Hope this helps.

PS: I think this only works with emulators.


Use some free SMS sending website to get the Intent of android.provider.Telephony.SMS_RECEIVED. means send a SMS to your mobile number using free sms service.


Indeed, it is quite easy with Android emulator to simulate an incoming sms,there are loads of tutorials for that for example: http://www.anddev.org/video-tut_-_simulating_incoming_phone_calls_-_sms_via_cmd-t135.html

But i'm not sure that you can do that with a phone. Using the Command line is only for emulator purposes. Though you could try to find the port on which your phone is connected and use the procedure with telnet to test it.


telnet localhost 5554

sms send +905xxxxxxxxx "Type your message here, between quotes"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜