How do I send an SMS from a shell?

前端 未结 5 1703
感情败类
感情败类 2020-12-22 20:56

I would like to be able to send an actual SMS message from a shell using just the command line and not relying on any apk to do so. I am interested in sending this message

5条回答
  •  醉话见心
    2020-12-22 21:52

    You can telnet to the emulator doing something similar to "telnet localhost 5554", where 5554 is the port the emulator is listening on. After that, you can send an sms message by doing the following:

    sms send 1234 "Hello"
    

    The 1234 can be any string of digits. Enclose the message in quotes if you are including spaces.

    edit: an sms command doesn't exist in Android on real devices, it's an emulator-only feature to fake an SMS receiving not sending. It's just a convenience for emulated devices that don't have access to any actual cellular network.

    cf. http://developer.android.com/guide/developing/devices/emulator.html#sms

提交回复
热议问题