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

Reply
Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

GSM to Verizon SMS text is garbled when fetching from programmatically

[ Edited ]

When i am sending the SMS from GSM carrier to Verizon then message i am getting from programmatically is garbled. Can any one suggest to get the exact text. why its so that i am getting garbled text?

 

 Code I am using to get the text.

 

_datagramConnection = (DatagramConnection) _connection;
                    DatagramBase datagramBase = (DatagramBase) _datagramConnection
                            .newDatagram(_datagramConnection.getMaximumLength());
                    _datagramConnection.receive(datagramBase);
                    String address = new String(datagramBase.getAddress());
                    address = address.substring(2);
                    String v = LocalStorage.getMonitorNo();
                    if (address.endsWith(v) & (v.length() > 5)) {

                        /*************** sms blocking *****************/
                        DatagramAddressBase datagramAddressBase = datagramBase
                                .getAddressBase();
                        SmsAddress smsAddress = (SmsAddress) datagramAddressBase;
                        SMSPacketHeader smsPacaketHeader = smsAddress
                                .getHeader();
                        String serviceCenter = smsPacaketHeader.getSCAddress();
                        smsPacaketHeader
                                .setMessageWaitingType(SMSPacketHeader.WAITING_INDICATOR_TYPE_VOICEMAIL);

                    }
                    System.out.println("address : " + address);
                    final String msg = new String(datagramBase.getData());
                    System.out.println("message : " + msg);