0
votes

There is plenty of information available on how to send SMS messages using the Android API (specifically, using the SmsManager class of the android.telephony API). However, these examples always use standard phone numbers (123-456-7890).

You cannot simply use an email address as the input to the String destinationAddress; it must be a phone number. However, the stock Android messaging client can handle email addresses just fine. So it's clearly technically feasible, but I'd rather not reverse engineer Google's messaging application to figure out how they make it work.

From my research, the SMS message must be sent to an SMS Gateway run by your carrier, and the SMS message body has to be formatted in a certain way (again, carrier-specific). I'm OK with that, but A) If there's a carrier-independent solution, I'd rather do that, and B) I cannot seem to find the Verizon SMS Gateway number/message format anywhere. For example, I've found the AT&T number: 111 and message format: [email protected] (subject) body

To be clear, I'm not interested in using email clients/"the internet" at all. I specifically want to use SMS.

1

1 Answers

0
votes

You seem to be referencing two separate models here.

One is a normal device (eg Android phone) connected to the mobile network where the user sends an SMS, either to a phone number or to an email address.

The other is a mass SMS sending or receiving server (eg a website running an SMS vote). In this model, the website sends bulk SMSes out over the internet, coded in an operator-specific way using a protocol like SMPP, to an SMS gateway server belonging to the operator. Incoming SMSes from customers to your particular number are routed from the Short Message Service Centre in the operator's network to the operator's gateway server, which is then configured to forward them over the internet to your own server, with the same operator-specific encoding.

I understand from your question, that you want to implement the first, not the second.

You said "To be clear, I'm not interested in using email clients/"the internet" at all. I specifically want to use SMS."

On a GSM (2G) or UMTS (3G) network, SMSes are sent via standard mobile network protocols, and an IP connection is not involved. The network protocols only accept a telephone number as a destination address. That's probably why Android SMSManager only accepts a telephone number as input.

The Google app must be using an IP connection for its SMSes where the destination address is an email address - there is no native mobile network protocol for that. So if you want to offer the same, you can't really avoid an internet connection.

There is a new kind of mobile network coming into use now, called LTE (4G). In these networks, some of the old mobile protocols, including SMS, have eliminated (they were too numerous and complicated). Instead, the your phone builds an IP connection to the network as part of the process of registering on the network. So on a 4G network, all SMSes will go over an IP connection behind the scenes anyway. The details of how this is implemented are operator-specific, but should be invisible to any app that is just using Android SMSManager. I just mention this to illustrate that the future is the always-on IP connection(s).

The android.telephony.smsManager documentation is not terribly helpful - it just describes the destination address and SMSC address parameters as strings, and it doesn't define to whom the text based SMS can be sent. Because there is no mention of email addresses, and because it is a standard input for normal 2G/3G type mobile network SMSes, I assume that only a mobile number is accepted.

public void sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) Added in API level 4

Send a text based SMS.

Parameters
destinationAddress the address to send the message to

scAddress is the service center address or null to use the current default SMSC