09-30-2009 11:39 AM
Hi all,
I'm newbie in blackberry development, please somebody help me with this problem. I used MessageConnection for sending sms and it doesn't work with CDMA, so I switch to DatagramConnection. However, when I send the message as the code below, the message content is messed up. In the receiver phone (no programming at this end), instead of the content "Test Message", I got something like È€◊‡€◊‡
Please help me to format the message content to readable format! Thanks !
public void sendsms(){
DatagramConnection dgConn;
try{
dgConn = (DatagramConnection)Connector.open("sms://xxxxxxxxxxx");
byte[] data = "Test Message".getBytes();
Datagram dg = dgConn.newDatagram(dgConn.getMaximumLength());
dg.setData(data, 0, data.length);
dgConn.send(dg);
} catch (IOException e) {
// Likely the stream was closed.
System.err.println(e.toString());
}
}
09-30-2009 03:16 PM
09-30-2009 07:34 PM
10-01-2009 08:48 AM
10-01-2009 10:22 PM
I tried different encoding. Some encoding can be sent to certain phone or network, some don't. Why sending sms manually, the message always being sent? Is there a way to make it work for any network?
Thanks
02-15-2010 02:42 PM
Haiau - Did you ever come up with a solution on this one? I think I'm encountering the same problem...
Scott