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
New Developer
Posts: 23
Registered: ‎04-01-2010
My Device: 9700
My Carrier: student

SMS sendin problem

i'm trying to create application that can send sms.

 

in install the application on many devices. it works on some devices and on others no.

i tried the application on 2 torch devises running on the same OS version. one of the devices is abel te send sms and the second one can't

here my code 

 

 

private static final class SmsMessage
{
private String _address;
private String _port;
private String _msg;


/**
* Creates a SMS message
* @param address The address of the recipient of the SMS message
* @param msg The message to send
*/
public SmsMessage(String address, String msg, String port)
{
_address = address;
_port = port;
_msg = msg;
}


public Message toMessage(MessageConnection mc)
{

String addressString = "//" + _address + ( _port.equals(NON_ZERO_PORT_NUMBER) ? ":" + _port : "" );

TextMessage m = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE , addressString);
m.setPayloadText(_msg);

return m;
}

public Datagram toDatagram(DatagramConnectionBase datagramConnectionBase) throws IOException
{
DatagramBase datagram = null;
byte[] data = _msg.getBytes("ISO-8859-1");
datagram = (DatagramBase) datagramConnectionBase.newDatagram();
SmsAddress smsAddress = new SmsAddress("//" + _address);
SMSPacketHeader smsPacketHeader = smsAddress.getHeader();
smsPacketHeader.setMessageCoding(SMSPacketHeader.MESSAGE_CODING_ISO8859_1);
datagram.setAddressBase(smsAddress);
datagram.write(data, 0, data.length);

return datagram;
}
}

Highlighted
New Developer
Posts: 23
Registered: ‎04-01-2010
My Device: 9700
My Carrier: student

Re: SMS sendin problem

any solution Smiley Indifferent

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: SMS sendin problem

It would help if you would describe what the exact problem is.