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

Regular Contributor
Posts: 55
Registered: ‎09-01-2010
My Device: Not Specified

Invoke SMS service with prepopulated massage in CDMA phone

I am using the following code to invoke SMS services with prepopulated massage and number.

                        MessageConnection mc = (MessageConnection)Connector.open(_openString);
                        TextMessage m = (TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE);
                        m.setAddress( "sms://" + SMSDetails[0] );
                        m.setPayloadText( SMSDetails[1] );
                        Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, new MessageArguments( m ) );


But did this code will work for both CDMA and GSM blackberry phone? Moreover I am using blackberry JDE for app development. Is there anyway to test the code in the simulator as CDMA mode?

Regular Contributor
Posts: 63
Registered: ‎10-06-2010
My Device: Not Specified

Re: Invoke SMS service with prepopulated massage in CDMA phone

[ Edited ]

Woman Sad  I am also faceing the same problem can any one give solution for this ,if you get any solution pls say to me.

New Contributor
Posts: 4
Registered: ‎10-01-2010
My Device: Storm
My Carrier: Verizon

Re: Invoke SMS service with prepopulated massage in CDMA phone

* TODO update these with the right values

String passAddr = PHONE_NUMBER; 
String messagePart = MESSAGE;

                    MessageConnection messageConnection = (MessageConnection) Connector.open("sms://" + passAddr); 
                    TextMessage sms = (TextMessage) messageConnection.newMessage(MessageConnection.TEXT_MESSAGE); 
                }catch(IOException e){

                try {
                    byte[] bytes = messagePart.getBytes();
                    DatagramConnection connection = (DatagramConnection) Connector.open("sms://"+passAddr);
                    Datagram datagram = connection.newDatagram( bytes, bytes.length );
                    connection.send( datagram );
                catch(Exception e) {



I have used the following snippet with successes on CDMA (like Verizon) and Non-CDMA networks.  Be sure you validate the phone number prior and break the message into 160 char parts before using this.


I'm not sure about testing as CDMA in the sims, but I have tested it on my personal CDMA phone and works fine.