Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass the new line on ADB

Tags:

android

shell

adb

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.

like image 497
fazil Avatar asked Oct 20 '22 15:10

fazil


1 Answers

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"
like image 159
kris larson Avatar answered Nov 01 '22 13:11

kris larson