简体   繁体   中英

Send SMS through ADB to phone

I want to send test SMS messages from my PC via adb, to the phone. 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. Is there something I can do with a real phone (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.

You need to declare a custom <intent-filer> in your AndroidManifest.xml and bind a BroadcastReceiver on that Intent. 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 :

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 :

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

You can also find here more thorough examples on what you can do using 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).

I assume that MightyText will probably be the easiest and quickest to set up between the two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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