Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 1
Registered: ‎03-09-2009
My Device: Not Specified

Basic SMS send failing (GSM to GSM, using SMSdemo code)

Hey, Im pulling my hair out here trying to get basic SMS code to work, and I must be missing something. Im using a T-Mobile Curve 8900 and Im developing a simple app to programmatically send SMS (no special listener on the other end - simply send a plain text message). Here's the code (copied from SMSdemo)


MessageConnection mc; try { mc = (MessageConnection)Connector.open("sms://:3590"); if(mc==null) throw new IOException(); TextMessage m = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE , "//" + mAddress + ":3590"); m.setPayloadText(mMsg); mc.send(m); mc.close(); }

It doesnt throw any exceptions, it just simply...doesnt send. Nothing in the Curve's outbox, nothing on the receiver phone. I've tried different phone number formats for constructing the address (15551234567, 5551234567, +15551234567) but none work. This is sending to/from a GSM network. Any clues? Do I need a different port, and if so which?


Also, for the issue of including CDMA, whats the proper way to handle this? I can use MessageConnection for GSM-GSM (well, in theory), and Datagram for CDMA-CDMA and CDMA-GSM, but what about GSM-CDMA?


Thanks for any help you can provide!



New Developer
Posts: 21
Registered: ‎03-09-2009
My Device: Not Specified

Re: Basic SMS send failing (GSM to GSM, using SMSdemo code)

Check out this link
New Developer
Posts: 12
Registered: ‎06-09-2009
My Device: Not Specified

Re: Basic SMS send failing (GSM to GSM, using SMSdemo code)

Hi !


I think your problem is with using ports.  you need to use port 0.

this port is the port which remote application is listening.

if you are sending sms to other phone, and you want to see  in its inbox, use port zero.


if you want to send on specific port - you need to use DatagramConnection and you need set UDH field to true.  follow this link:




it describes how you can correctly form and send binary sms using DatagramConnection.