Send SMS through ADB to phone - android

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.

Related

Using BroadcastReceiver Without GCM?

I need that my app will send a string to another android device and on the receiving android device side i want to make something with that string.
How can I use BroadcastReceiver with the callback OnReceive() just to program the string that he will get Without using the GCM if it is possible.
Thanks.
BroadcastReceivers are for intra- or inter- application communications on a single device. To send messages between discrete devices without a cloud-based solution (such as GCM) then you'll be looking at using the Bluetooth stack for ah-hoc networks or the NetworkServiceDiscovery APIs for devices on the same local network.
Depending on your use case, there are examples to get you going under each of the provided links.

Simplest way to pass information between the same application installed on different phones

As the topic name suggests, what I am looking for is to add my android app the option to send data to a different phone running the same application so the receiving phone will process it accordingly.
The obvious option for me was to use app engine and use push notification with the phone number acting as the identifier.
Does a simpler solution exist?
Thanks ahead :)
The best and most robust solution is to have something like your messaging clients, in which Device A sends data to the server, which pushes it to Device B. Device B sends a reply to the server, which pushes it to Device A.
This process has the advantage of retrying the sending without requiring your users to stay connected, as may be required if Device B is offline when A sends a message.
A less foolproof solution is to have a server work as a middle man, and get each device's IP Address, and then open up a direct socket between them. In this solution, you'll lose any data that doesn't make it through.
If the devices are on the same network or in Bluetooth range, you could try Bluetooth or WiFi direct.

How to send SMS from Android emulator to a phone using GSM modem?

Is it possible to send SMS from Android emulator to a mobile phone via a GSM modem connected to a USB port of computer ? If it is possible how can I do that
Thanks in advance!
You could do that but android won't detect it as a native antena, in other word, all functions from android to send sms or initiate a call won't work.
If the device is visible is /dev/.. You could be able to open it and send command trough serial. Unless someone wrote a driver so android can load it for gsm communication inside the emulator, my guess is that it's pretty useless.
Anyway, the emulator does have a way to test sms sending as far as I can remember, and if you really want to send sms trough your gsm dongle, It's probably a better idea to start writing a script using python for example. There is also a library that enable sms sending from linux, it might also work on other platforms.
Sending sms from python from computer:
http://designbuildtestrepeat.wordpress.com/2008/06/26/sms-over-3g-and-bluetooth-from-python/
Checking incoming sms for emulator android:
http://davanum.wordpress.com/2007/12/15/android-listen-for-incoming-sms-messages/
Sending sms between emulators:
http://xjaphx.wordpress.com/2011/07/07/sending-messages-among-devices/
And then it really depends on what you need. You didn't exactly said why you wanted to do that. You didn't say if you wanted to test sms messaging or wanted to send actual sms from computer. It's not really clear why you need android and the gsm modem at the same time.

sending a SMS from android phones to a computer?

I am creating an android application which gets the phones location, Latitude and Longitude, and time and sends it to a central database at regular intervals. The problem is I am using SMS to send this data and I am having trouble figuring out where to send it. The first thing which came to my mind is a computer which stores all this data and reads it then carries out an action based on the data, in this case it maps it.
So is it possible to send a SMS to a computer? Or should I try out a different method to send the data?
Any suggestions would be helpful. Thanks! :)
EDIT
I understand it is possible to connect my phone to the computer and then transfer the SMSs but I actually just have 1 phone right now and I cant have it always hooked up to the computer.
Euhm SMS? I dont think that is possible.
Try to use JSON.
https://www.google.nl/search?sugexp=chrome,mod=18&sourceid=chrome&ie=UTF-8&q=Send+data+to+server+android+json
You can connect you phone to your computer as SMS modem and get its SMS from your phone. Almost phone can do this. But the most common way is that integrated with a web service.
While it is possible to send sms to a computer if that computer has a GSM module (or mobile phone connected as modem) you should rather consider a different method.
I'd go with sending emails or - if you are willing to - create an AppEngine Project to receive the data.

How to trigger an android app on the phone using the laptop?

I have an application on my G1 Android Dev phone(android 1.5). I need to trigger this application automatically from my laptop. The system will not be deployed in an area where there is WiFi, so I cannot send a packet to a service on the phone which will be listening for a particular packet from the laptop and then call an intent to launch my application. Is there any way in which I can send out a packet using the USB cable to a service running on the phone? Are there APIs available for this?
You may be able to invoke the launch app intent via adb shell, the start command, and the application's launch intent. It looks like this person got it to work. This may require rooting a physical device.
Edit:
Another idea: launch the app with the UI Excerciser monkey, but specify 0 for the event count.

Categories

Resources