Send SMS via adb shell service call isms Android 4.1.2

Alejandro Quintanar picture Alejandro Quintanar · Dec 11, 2014 · Viewed 8.6k times · Source

Currently I send SMS by this command:

adb shell service call isms 6 s16 "phoneNumber" i32 0 i32 0 s16 "smsText"

in Android 2.3.6 and works perfectly.

Now I want to use the same command in Android 4.1.2 but when I send the command I received this output in Logcat

> 12-11 14:17:37.97 1626-2182/? D/PhoneRestrictionPolicy﹕ SmsRestrictionPolicy.canOutgoingSms >>>>

Anyone Can help me to remove this "SmsRestrictionPolicy" please?

Thanks

Answer

Phil picture Phil · Apr 17, 2015

Quoting this post:

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.


From comments on this post it appears that sending via service call isms, as mentioned in the question, is not possible (though I would bet it is possible if your app is set as the default SMS app for the device).


One work-around to sending an SMS without user interaction would be to send the number and message to a server that sends SMS messages. There is likely already a third party tool for this. At quick glance, this may be useful.