Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SmsManager SendDataMessage in Android

Tags:

android

sms

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?
like image 506
Chris Avatar asked Dec 22 '16 23:12

Chris


People also ask

What is SmsManager in Android?

In Android, you can use SmsManager API or devices Built-in SMS application to send SMS's. In this tutorial, we shows you two basic examples to send SMS message − SmsManager API SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);

How do I open SMS app on Android?

Open Settings . Click Apps. In the list of apps, click Messages. SMS.


1 Answers

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.

like image 105
Hod Avatar answered Oct 01 '22 18:10

Hod