BlackBerry - Exception with null message when sending sms using Connector
- by vikram deshpande
I used code given but I am getting "IOCancelledException" and "IOException". And IOCancelledException.getMessage() / IOException.getMessage() giving null string, it does not give error message. Please help me understaing reason.
class SMSThread extends Thread {
Thread myThread;
MessageConnection msgConn;
String message;
String mobilenumber;
public SMSThread(String textMsg, String mobileNumber) {
message = textMsg;
mobilenumber = mobileNumber;
}
public void run() {
try {
msgConn = (MessageConnection) Connector.open("sms://+"
+ mobilenumber);
TextMessage text = (TextMessage) msgConn
.newMessage(MessageConnection.TEXT_MESSAGE);
text.setPayloadText(message);
msgConn.send(text);
msgConn.close();
} catch (IOCancelledException ioce) {
System.out
.println("IOCancelledException: " + ioce.getMessage());
} catch (IOException ioe) {
System.out.println("IOException: " + ioe.getMessage());
} catch (Exception e) {
System.out.println("Exception: " + e);
}
}
}