Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
New Developer
Posts: 2
Registered: ‎01-22-2010
My Device: 8310
My Carrier: Sprint

SMS between java applications on Blackberries between CDMA and GSM

Hi,

 

I have seen related post on the question in the forum, but with out a solution. So here is what i am trying to do..

 

Send port directed SMS between two java application on Blackberry across different networks. Given the fact that MessageConnection works on GSM and DatagramConnection works on CDMA the implementation is based on the radiotype. The application sends on port 5016(to be compatible with non-blackberies) and listens at port zero for all SMS

 

Below is the matrix of the output. The application sends at 5016 and listens at port 0 for GSM and sends and receives at port 0 for CDMA

 

 


 

Sprint (CDMA)     ATT(GSM)        Verizon (CDMA)             TMobile (GSM)

 


 Sender                     Received                     Received              Received


 

Received              Sender             Not Received                 Not Received 


 

Received             Received               Sender                         Received


 

Not Recieved    Not Received       Not Received                       Sender

 

 

 

 

 


 

 

 

 

 

 

Sending part

 

 

public  void sendMessage(CryptoMidlet midCrypto, String phoneNumber, Vector v, boolean port, boolean isBinary) throws Exception {

        initalizeSMSConnection();
                              
        // Itereate tru the message vector and send it
        int size = v.size();
                    
        if(smsconn != null && !Utility.isCDMA()) { //GSM
            for(int i=0; i<size ; i++) {
                String targetAddress = (port) ? "sms://+" + phoneNumber + ":5016" : "sms://+" + phoneNumber;
                MessageConnection messageConnection = (MessageConnection)Connector.open(targetAddress);
                  
                if(isBinary) {
                    BinaryMessage bMessage = (BinaryMessage)messageConnection.newMessage(MessageConnection.BINARY_MESSAGE);
                    byte[] encodedMessage = (byte[])v.elementAt(i);
                    bMessage.setPayloadData(encodedMessage);
                    Thread.sleep(1000);
                    messageConnection.send(bMessage);
                } else {
                    TextMessage msg = (TextMessage)messageConnection.newMessage(MessageConnection.TEXT_MESSAGE);
                    msg.setAddress(targetAddress);
                    msg.setPayloadText((String) v.elementAt(i));
                    messageConnection.send(msg);
                }
                messageConnection.close();
            }
          } else if(datagramConnection != null && Utility.isCDMA()) { //CDMA
                byte[] finalMessage  = null;
                for(int i=0; i< size; i++) {
                   DatagramConnection datagramConnection = (DatagramConnection)Connector.open((port) ? "sms://+"+phoneNumber+ ":0" : "sms://+" + phoneNumber);
                   if(isBinary) {
                       finalMessage = (byte[])v.elementAt(i);
                   } else {
                       String msgTemp = (String)v.elementAt(i);
                       finalMessage = msgTemp.getBytes("UTF8");
                   }
                   Datagram datagram = datagramConnection.newDatagram(finalMessage,finalMessage.length);
                
                   //Thread.sleep(1000);
                   datagramConnection.send(datagram) ;
                   datagramConnection.close();
                }
         }
}

 

 

Listening part

 

 

public void initalizeSMSConnection() {

        boolean success = true;
        if (smsconn == null && !Utility.isCDMA()) {
            String smsConnection = null;
            smsConnection = "sms://:0";
            try {
                smsconn = (MessageConnection)Connector.open(smsConnection);

            }catch (Exception ioe){
            }
        } else if (datagramConnection == null && Utility.isCDMA()) {
            String smsConnection = "sms://:0";
            try {
                datagramConnection = (DatagramConnection)Connector.open(smsConnection);

            }catch (Exception ioe){
            }
        }
    }

 

Does any one has a solution to how this could work between all BB across different carriers on different n/w

 

New Developer
Posts: 13
Registered: ‎12-26-2009
My Device: 8120
My Carrier: tmobile

Re: SMS between java applications on Blackberries between CDMA and GSM

I'm also working on a similar project and have tried sending/receiving on port zero to be more 'cdma friendly' but with the same results??  basic failure for cdma networks to receive messages sent from a gsm device...