【问题标题】:How to parse string for send SMS text message via ADB如何解析字符串以通过 ADB 发送 SMS 文本消息
【发布时间】:2019-10-10 11:58:27
【问题描述】:

我正在尝试通过 ADB 终端命令发送短信。

$message = "Joe Doe. We find a provider for your request, touch the link below for see more details.
https://massasistencia.com/detalles-cliente/23"

exec('adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+541156409605" s16 "null" s16 "' .$message. '" s16 "null" s16 "null"')

收到的消息只说“乔”

如果我只发送链接,SMS 就可以到达。 如果我对“Joe Doe”执行 str_replace 替换“”为“-”仅发送名称,则消息正常到达。

我认为问题在于空格“”。

这是我正在使用的命令行,短信到达,所以命令有效,问题是消息本身。

adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+541156409958" s16 "null" s16 "Hi" s16 "null" s16 "null"

【问题讨论】:

标签: php parsing sms adb message


【解决方案1】:

您不需要在消息中的每个空格字符之前添加斜杠字符 ()。 这不是暴徒生活吗? 尝试将您的短信正文用单引号括起来,您就完成了。

adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+541156409958" s16 "null" s16 "'Joe Doe. hello'" s16 "null" s16 "null"

【讨论】:

    【解决方案2】:

    您需要在消息中的每个空格字符之前添加斜杠字符 (\)。 以下命令只会发送 Joe:

     adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+541156409958" s16 "null" s16 "Joe Doe. hello" s16 "null" s16 "null"
    

    以下命令将发送 Joe Doe。你好:

    adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+541156409958" s16 "null" s16 "Joe\ Doe.\ hello" s16 "null" s16 "null"
    

    【讨论】:

    • 换行怎么样?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-31
    • 1970-01-01
    • 2011-02-05
    • 1970-01-01
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多