Writing MIDlet for SMS - III
11 April 2008This 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 …
Related Posts:
- Writing MIDlet for SMS - VI
- Writing MIDlet for SMS - IV
- Writing MIDlet for SMS - I
- Writing MIDlet for SMS - II
- Deploying MIDlets onto Mobile Devices (III)
- MIDlet Suite
- Writing MIDlet for SMS - V
- Creating J2ME MIDlet Project - I
- Record Management System (III)
- Converting an existing project to an EclipseME project
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