• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

SMS picking phone number from a Numeric field

 
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
 
author
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
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
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
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic