Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SMS

 
Danish Shaukat
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all !
I'm using the following code tosend a message.It compiles well but when i run the application nothing really happens.
Any help would be appreciated.
--Danish

void sendMessage()
{
String text="HelloWorld !";
MessageConnection conn = null;
String url = "sms://+5550000";
try {
conn = (MessageConnection) Connector.open(url );
// do something with the connection
}
catch( Exception e ){
// handle errors
}
finally {
if( conn != null ){
try { conn.close(); } catch( Exception e ){}
}
}
//--------
try
{
sendText(conn,text);
}
catch(Exception q){}
}

public void sendText( MessageConnection conn, String text )
throws IOException, InterruptedIOException {
TextMessage msg = (TextMessage)conn.newMessage( conn.TEXT_MESSAGE );
msg.setPayloadText( text );
conn.send( msg );
}
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MIDP API and CLDC don't support sending SMS messages because this is not supported by all devices (eg, a Palm PDA). Therefore it's not in the MIDP specification.
This leads to the obvious conclusion that sending SMS messages is device dependant. Well, it is. Therefore you have to use a device specific API as an extension to your current code (making it a whole lot less portable btw).
If you're using a Nokia, check www.forum.nokia.com to download the SMS API. If you're using a different vendor, please check their website for instructions.
Greetings, Erik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic