Chris
Chris

Reputation: 808

SmsManager SendDataMessage in Android

I was using the Android SmsManager provided API sendDataMessage to send SMS messages and noticed that the behavior seems to change from different devices, Here are my observations.

I am able to send messages successfully

  1. On all devices (Nexus 6p, Nexus6, Nexus5) if Cellular data is turned on
  2. On Nexus6p only if cellular data is turned off

My Questions:

  1. Are there any internal changes that occured? Is this device specific/ carrier specific or API specific?
  2. How is the sendDataMessage different from the sendTextMessage with respect to the communication channel used?
  3. Does the byte[] data sent to the API needed to be 7 bit encoded?

Upvotes: 6

Views: 1517

Answers (1)

Hod
Hod

Reputation: 2276

Regular (text) SMS messages are sent over the cellular network control channel. You can read a good description of exactly what's going one here: http://computer.howstuffworks.com/e-mail-messaging/sms.htm

When you use sendDataMessage, you're sending over your cell data channel. This is separate from the voice and control channels. That's why nothing gets sent when cell data is off.

The encoding depends on the language and whether it's text vs. data. See 'Message size' in this article: https://en.wikipedia.org/wiki/Short_Message_Service

SMS is complex. You might want to look at a solution provider like Twilio instead of doing it yourself.

Upvotes: 1

Related Questions