Hi All
I am trying following code to send SMS in Nokia dual SIM phone C2. When I have single SIM active, it works fine but if I have 2 SIMs active then phone hangs with screen saying "Sending text message"
StringBuffer addr = new StringBuffer(20);
addr.append("sms://");
addr.append("+91");//India
addr.append(phoneNumber);
String address = addr.toString();
try {
smsconn4sending = (MessageConnection) Connector.open(address);
TextMessage txtmessage = (TextMessage)smsconn4sending.newMessage(MessageConnection.TEXT_MESSAGE);
txtmessage.setAddress(address);
txtmessage.setPayloadText("My message");
smsconn4sending.send(txtmessage);//
}catch(IllegalArgumentException illegalArgumentException){
form.deleteAll();
form.append("IllegalArgumentException Error while sending sms");
errorCode = 1;
}catch(InterruptedIOException interruptedIoException){
form.deleteAll();
form.append("InterruptedIOException Error while sending sms");
errorCode = 2;
}catch(IOException ioException){
form.deleteAll();
form.append("IOException Error while sending sms");
errorCode = 3;
}catch(NullPointerException nullPointerException){
form.deleteAll();
form.append("NullPointerException Error while sending sms");
errorCode = 4;
}catch(SecurityException securityException){
form.deleteAll();
form.append("SecurityException Error while sending sms");
errorCode = 5;
}catch (Exception e) {
form.deleteAll();
form.append("Exception while sending sms");
errorCode = 6;
}
if (smsconn4sending != null) {
try {
smsconn4sending.close();
} catch (IOException ioe) {
form.append("\n\nError while closing sms connection");
errorCode = 5;
}
}
Please let me if i can something to make it work fine even with dual active sims

Reply With Quote

