Writing MIDlet for SMS - III

11 April 2008

This post continues MIDlet development fort Short Message Service. Do read the first 2 parts before this one.

I will write startApp() method. This is part of MIDlet lifecycle. Application Management System calls it after calling the constructor.

public void startApp() {
// SMS connection to be read.
String smsConnection = "sms://:" + smsPort;
content.setString(smsConnection);
 
// Open the message connection.
 
try {
smsconn = (MessageConnection)Connector.open(smsConnection, Connector.READ);
} catch (Throwable t) {
content.setString(t.toString());
}
display.setCurrent(resumeScreen);
}

For handling notification that a message arrived, we will write notifyIncomingMessage method that will take MessageConnection as argument.

public void notifyIncomingMessage(MessageConnection conn) {
if (thread == null) {
done = false;
thread = new Thread(this);
thread.start();
}
}

Continued …

del.icio.us:Writing MIDlet for SMS - III  digg:Writing MIDlet for SMS - III  spurl:Writing MIDlet for SMS - III  wists:Writing MIDlet for SMS - III  simpy:Writing MIDlet for SMS - III  newsvine:Writing MIDlet for SMS - III  blinklist:Writing MIDlet for SMS - III  furl:Writing MIDlet for SMS - III  reddit:Writing MIDlet for SMS - III  fark:Writing MIDlet for SMS - III  blogmarks:Writing MIDlet for SMS - III  Y!:Writing MIDlet for SMS - III  smarking:Writing MIDlet for SMS - III  magnolia:Writing MIDlet for SMS - III  segnalo:Writing MIDlet for SMS - III  gifttagging:Writing MIDlet for SMS - III

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: Writing MIDlet for SMS - III

Leave a Reply