Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send SMS via adb shell service call isms Android 4.1.2

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

like image 501
Alejandro Quintanar Avatar asked Dec 11 '14 19:12

Alejandro Quintanar


1 Answers

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.

like image 185
Phil Avatar answered Sep 28 '22 15:09

Phil