18

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

Rishabh Srivastava
  • 3,683
  • 2
  • 30
  • 58
  • Have you tried this? http://stackoverflow.com/questions/4043490/how-do-i-send-an-sms-from-a-shell – Phil Apr 17 '15 at 16:08
  • Possible duplicate of [Sending a SMS on Android through ADB](https://stackoverflow.com/questions/17580199/sending-a-sms-on-android-through-adb) – Taknok Aug 10 '17 at 14:45

4 Answers4

3

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.

Community
  • 1
  • 1
Phil
  • 35,852
  • 23
  • 123
  • 164
1

Try with telnet and sms send commands.

Read more here.

Community
  • 1
  • 1
klimat
  • 24,711
  • 7
  • 63
  • 70
1

My Environment:

  • Android 4.1.2
  • MIUI ROM

you can try this.

Switch to the message application user before service call isms .. command.

su u0_a34 \
service call isms 5 s16 "10086" i32 0 i32 0 s16 "11"

u0_a34 is the user name of the message application.

bootlater
  • 11
  • 1
1

It didn't work because in android 4.1.2 the isms number is 5 and not 6. So it's :

adb shell service call isms 5 s16 "com.android.mms" s16 "+01234567890" s16 "+01000000000" s16 "Hello world !" i32 0 i32 0

You could check how to do it for any android version here : link

Community
  • 1
  • 1
Taknok
  • 717
  • 7
  • 16