hi,
I have created an application which takes cell phone number into a text field and sends SMS.
But i encounter a problem....
1) For example, the number is 98931-12345 then i can send SMS only if i give 93112345, the last 8 numbers. I m unable to find the problem.
2) If this persists, then how can i SMS to outside countries where it is required to add 91 before the number.
3) Also, if my application takes only the last 8 numbers then i cannot send SMS to anybody whose cell number starts with 96 or 94 or anything other number.
What have i done wrong in this code.
*****************************************
//Here getphoneno gets the
string from a TEXTFIELD defined as
//phonefield = new TextField("Phone Number", "", 15, TextField.NUMERIC);
try {
//new
Thread(this).start();
String addr = "sms://" + Integer.parseInt(getphoneno.getString());
MessageConnection conn = (MessageConnection)Connector.open(addr);
TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText(getsendtext.getText());
conn.send(msg);
setform.setTitle("Message Sent");
display.setCurrent(setform);
new Thread(this).start();
}
catch( Exception e )
{
// handle errors
}
}
**********************************
If i define it as PHONENUMBER, then also it wouldn't send if the numbers are more than 10.
Plz help.
Thanks in Advance
Sangeeta