Writing MIDlet for SMS - I

9 April 2008

SMS stands for Short Messaging Service and it is very common in mobile communication. J2ME provides an API for SMS which makes messaging very easy.

I will write a MIDlet to show how to create a messaging system using javax.wireless.messaging.
First step is to import all the required APIs:

import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.*;
import java.io.IOException;

MIDlet class should extend MIDlet class. Since it will be a multithreaded application, we need to implement Runnable interface. To provide action listeners, we will also implement CommandListener and MessageListener interfaces.

public class SMSReceive extends MIDlet
implements CommandListener, Runnable, MessageListener {

Now we may declare the commands we want to have in our MIDlet.

/** user interface command for indicating Exit request. */
Command exitCommand = new Command("Exit", Command.EXIT, 2);
/** user interface command for indicating Reply request */
Command replyCommand = new Command("Reply", Command.OK, 1);
/** user interface text box for the contents of the fetched URL. */

Do follow the next posts on this.

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

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 - I

Leave a Reply