Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send an SMS from a shell?

Tags:

android

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 between phones, not from the emulator to the phone. For example, by running the command:

service call phone 2 s16 "1234567890" 

I can place a call from phone to phone using the command line. The 'service list' command shows an isms service, which I can't seem to provide the correct arguments for. I would assume that one of the args should be a PDU string but haven't had any luck so far.

like image 903
reproba Avatar asked Oct 28 '10 13:10

reproba


People also ask

Can you send SMS from Linux?

You can send SMS by running a Python script in Linux Command-line. I have included here the python code for the script. But for this you need the SMS gateway of your carrier.


2 Answers

In fact, this can be done but requires adb to be installed (Part of the android SDK)

adb shell am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body "SMS BODY GOES HERE" --ez exit_on_sent true adb shell input keyevent 22 adb shell input keyevent 66 

Where CCXXXXXXXXXX is country-code followed by phone number. This may not work correctly on non-standard android installations, you will need to find the correct keyevent values to pass.

like image 161
arpz Avatar answered Sep 21 '22 08:09

arpz


How about this?

service call isms 5 s16 "+??????????" i32 0 i32 0 s16 "SMS TEXT HERE" 
like image 42
Dmitry Avatar answered Sep 19 '22 08:09

Dmitry