简体   繁体   English

通过亚行发送短信到手机

[英]Send SMS through ADB to phone

I want to send test SMS messages from my PC via adb, to the phone. 我想通过adb将PC上的测试短信发送到手机。 Is this possible? 这可能吗? I've seen scripts to automate sending SMS from the phone, but I want to simulate SMS messages to the phone. 我已经看过脚本自动手机发送短信,但我想模拟短信到手机。 I was able to do this via the emulator by telneting to it. 我能够通过模拟器通过telneting来做到这一点。 Is there something I can do with a real phone (Galaxy Nexus). 我可以用真正的手机(Galaxy Nexus)做些什么。 I do'nt have the development phone hooked up to phone service; 我没有将开发电话连接到电话服务; I want this to be directly from the comptuer to the phone. 我希望这可以直接从计算机到手机。

You could develop a small application that receives an Intent and which is capable of sending an SMS accordingly to the received data. 您可以开发一个接收Intent的小应用程序,它能够相应地向接收的数据发送SMS。

You need to declare a custom <intent-filer> in your AndroidManifest.xml and bind a BroadcastReceiver on that Intent. 您需要在AndroidManifest.xml声明自定义<intent-filer>并在该Intent上绑定BroadcastReceiver So you will be advertised everytime an Application issues this Intent. 因此,每当应用程序发出意图时,您都会被广告。

On the other side, use the command line to send intents to your VMs using : 另一方面,使用命令行向您的VM发送意图:

adb shell am start -a broadcast com.messenger.sms.send -e message my_message

In the BroadcastReceiver , the extra data will be accessible through a call to : BroadcastReceiver ,可通过调用以下方式访问额外数据:

intent.getExtras().getString("message");

You can also find here more thorough examples on what you can do using am . 您还可以在此处找到有关使用am可以执行的操作的更详尽示例。

Do you have another cell phone with actual service? 你有其他手机有实际服务吗?

If only a rough simulation is what you're looking for, I'd suggest you set up a Google Voice account to receive texts from a Google Voice number via wifi, or just use something like MightyText to synchronize the sms messages/notifications from your activated phone with your deactivated development phone (over wifi). 如果您只是想要粗略模拟,我建议您设置Google语音帐户以通过wifi接收来自Google语音号码的文本,或者只使用MightyText之类的内容来同步来自您的短信/通知激活手机与您的停用开发手机(通过wifi)。

I assume that MightyText will probably be the easiest and quickest to set up between the two. 我认为MightyText可能是两者之间最简单,最快捷的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM