BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-21-2009, 02:48 AM   #1 (permalink)
New Member
 
Join Date: Sep 2009
Model: 9530
PIN: N/A
Carrier: GSM
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Funky characters got appended with sms when sms send using DatagramConnection

Please Login to Remove!

Hi,
I am new to BB application development itried to write an application for sending multiple messages in a loop in the emulator it works fine . But when tested in the phone some special charcters are appeneded to the sms ie
two or three characters then the sms.The method in which i had send sms using the following code

DatagramConnection smsConnection =
(DatagramConnection)Connector.open("sms://18001234567:9876");
SmsAddress destinationAddr = new SmsAddress("//18001234567:9876");
SMSPacketHeader header = destinationAddr.getHeader();
header.setStatusReportRequest(false);
header.setUserDataHeaderPresent(true);
header.setValidityPeriod(SMSParameters.PERIOD_INDE FINITE);
header.setDeliveryPeriod(SMSParameters.PERIOD_INDE FINITE);
header.setMessageClass(SMSParameters.MESSAGE_CLASS _1);
header.setMessageCoding(SMSParameters.MESSAGE_CODI NG_8_BIT);
int maxDatagramLength = smsConnection.getMaximumLength();
final byte myUDH = new byte[] {
0x06, 0x05, 0x04, 0x04, 0xd2, 0x04, 0xd2 };
maxDatagramLength -= myUDH.lenth;
byte[] message = "Bonjour de Montréal".getBytes("UTF-8");
byte[] completePayload = new byte[myUDH.length + message.length];
System.arraycopy(myUDH, 0, completePayload, 0, myUDH.length);
System.arraycopy(message, 0, completePayload,
myUDH.length, message.length);
Datagram d = smsConnection.newDatagram(completePayload.length);
((DatagramBase)d).setAddressBase(destinationAddr);
d.setData(completePayload, 0, completePayload.length);
smsConnection.send(d);


i tried with MessageConnection also in that case i encountered the problem in emulator too . does any have a work around. please post a working code or give some suggestion.

Thank you in advance.
Offline  
Old 09-21-2009, 09:42 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2008
Model: 8520
OS: 5.0.0.509
PIN: N/A
Carrier: TMo
Posts: 176
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

:d.........

Last edited by kellyjdrummer : 09-21-2009 at 09:45 PM.
Offline  




Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.