How to send SMS from terminal in background on Android? I'm trying to send text message (SMS) from my Android terminal app in background (sim 1 or 2).
I can send message in foreground using this command:
am start -a android.intent.action.SENDTO -d sms:121 --es sms_body &quot;test text&quot; --ez exit_on_sent true;
input keyevent 22;
input keyevent 66;

But this command don't work in background.
So, how can I send message in background from my terminal?
Note: Android version 6.0. Rooted device
The syntax that appears to work as attested over at our sister site stackoverflow is and is explains in detail:

adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+1234567890" s16 "null" s16 "Hey\ you\ !" s16 "null" s16 "null"


  "Isms method number (5 and 7 above) may change with the android version . Read full explanation to understand it."