5

I would like to be able to send a SMS from my Android phone while it's connected to my computer using the following ADB commands so i refered this link. send a SMS from my Android phone

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

adb shell input keyevent 66

Its working fine for me so when I started testing it, I can send characters,white spaces,special characters but not the new line. Say like I had 2 lines of text when I tried to pass, first line characters were sent but not the second line ones. So I want to know how to send the many lines through adb. Even I tried all escape sequence characters but still I couldn't pass. So anyone can tell me how to solve this .. Thanks in advance.

1 Answer 1

4

This is reported to work:

adb shell "NL=$'\n' ; am start -a android.intent.action.SENDTO -d sms:CCXXXXXXXXXX --es sms_body \"SMS BODY ${NL} GOES HERE\" --ez exit_on_sent true"
1
  • Great! Updating answer to only show the one that worked, for future readers. Mar 25, 2015 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.