5

I'm having trouble with the sendDataMessage() method in SmsManager.

Sending a data SMS between 2 GSM emulator's appears to at least partially work, but I get a NullPointerException when using the same method on a Verizon CDMA phone.

I found this link to a bug report for something similar:

"SmsManager.sendDataMessage() always fails on CDMA devices because there is no code path for it to succeed. The failure can be seen in the radio log, where com.android.internal.telephony.cdma.sms.BearerData.encodeEmsUserDataPayload() throws a CodingException."

But I'm wondering if anyone's found a workaround to do something similar on CDMA phones.

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
bfly2000
  • 198
  • 6
  • 1
    I think for now I might just settle with sendMessage() and use a special tag in the messages, then intercept all messages and check for the tag, but this is a hack I'd rather not do – bfly2000 Jul 01 '11 at 16:00
  • Have you yet resolved this problem? I have the same problem, and I am tending to think that it is a provider (Verizon Wireless in my case) related limitation (or rather restriction). – xtrem Sep 27 '12 at 13:19
  • Hi @bfly2000, I am coming in on this late, but I am having the same issue. Do you know if this has been resolved to date, and how do you get the radio log? – Simon Jan 23 '15 at 18:04

1 Answers1

0

This code works fine for GSM and CDMA both

String sms = message.getText().toString();

            if(PhoneNumberUtils.isWellFormedSmsAddress(dest))
            {
                for(String contact:multiContact)
                {
                    smsManager.sendTextMessage(contact, null, sms, null, null);
                    Toast.makeText(SampleSms.this, "SMS messgae Sent to"+contact, Toast.LENGTH_LONG).show();
                }

            }
            else
            {
                Toast.makeText(SampleSms.this, "SMS messgae Sent failed", Toast.LENGTH_LONG).show();
            }

I had also used sendDataMessage() but I got error. But above code is working fine

Balban
  • 718
  • 3
  • 9
  • 24
  • im trying to send a data sms, because I'm using this as a specific method of sending a program data. This isn't going to be a standard text message, and it would get intercepted by an sms messaging client. Even if i set my program to have a high android:priority for the SMS_RECIEVED intent, I still have to deal with parsing and making sure the message is from my program, theres no real way to ensure that I'm not intercepting a real text message. – bfly2000 Jun 29 '11 at 05:31
  • Have you used port no in `sendDataMessage()`? However This message is depricated – Balban Jun 29 '11 at 06:11
  • of course, i don't think it would work without a port no., and I'm unsure as to why it's deprecated, I was hoping there was a way to mimic a data sms for a cdma network in android at the moment – bfly2000 Jun 29 '11 at 06:30