• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SMS picking phone number from a Numeric field

 
Sangeeta Vepa
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Umm. Have you tried "+9893112345"?
 
Sangeeta Vepa
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Ron,
Thankyou so much. It needed a "+" and also removal of Integer.parseInt(... which was creating the problem. Now it works fine.
Thanks again for the prompt reply ...
Sangeeta
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sangeeta Vepa:
hey Ron,

That was the first time someone has taken me as Ron Jeffries by mistake...
 
Sangeeta Vepa
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Lasse Koskela,
I m really sorry. That really was a mistake. Hope u wouldn't mind.
Anyways, thanks for the help.
Regards
Sangeeta
 
Sangeeta Vepa
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem. I took it as an honor to be mistaken for Ron Jeffries.
 
Sangeeta Vepa
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic