Sunteți pe pagina 1din 8

MOBILE DEVICE PROGRAMMING SEMINAR REPORT

J2ME - RMS
-Java Micro Edition-Record Management System-

Course Code: SWE423

FACULTY: PROF. NADESH RK JAN-MAY, 2013 VIT UNIVERSITY VELLORE

Submitted By P H N HARISH (09mse026)

Index
1. J2ME Introduction. 2. The Mobile Information Device Profile 2.0/ CLDC 3. Structure of a MIDlet. 4. Developing a MIDlet. 5. The Record Management System.

1. J2ME Introduction
J2me stands for Java Micro Edition which is a platform for developing applications running on mobile and embedded devices such as mobile phones, set-top boxes, blue-ray

disc players, digital media devices, M2M modules, printers etc. The java community grouped all these devices according to their purpose and capabilities. The lowest common denominator for each device group and arrange them into configurations. To provide a vertical support within each configuration, profiles were created. The above architecture for java shows the position of J2ME along with various configurations and profiles. Each combination of configuration and profile matches a group of products specifically optimized to match the memory, processing power and I/O capabilities of each device. A configuration consists of a combination of a virtual machine and a minimal set of class

libraries designed to provide the base functionality for a distinct set of devices with similar characteristics. There are two such configurations. They are 1. Connected Device Configuration (CDC) designed for devices with more memory, faster processors and greater network bandwidth like home appliances, navigation systems etc. 2. Connected Limited Device Configuration (CLDC) is designed for devices with intermittent network connections, small processors and limited memory like pagers and mobiles and PDAs.

2. The Mobile Information Device Profile 2.0/ CLDC


MIDP offers the core functionality required by a mobile application like user interface, network connectivity, data storage, and application lifecycle management. This profile adds an additional layer on top of the CLDC configuration and thus providing all the necessary APIs. CLDC defines a standard for devices with the following capabilities. 160 KB to 512 KB available memory. 16/32 bit processor. Low power consumption. (operating on battery) Intermittent network connection, possibly wireless with a bandwidth of 9600 bps. At least 128 KB of non-volatile money. 32 KB of volatile memory for the java run time object memory.

The various packages in MIDP are Java.microedition.lcdui Java.microedition.lcdui.game Java.microedition.rms Java.microedition.midlet Java.microedition.io Java.microedition.media Java.microedition.media.control Java.microedition.pki

Lcdui package provides implementation of user interfaces in MIDP applications. Rms provides mechanism to store data and retrieve it. MIDP application life cycle is managed by MIDlet package. The various classes and interfaces in Lcdui are

3. Structure of a MIDlet.
A mobile application developed using MIDP is called MIDlet. Every application must extend the MIDlet class found in the javax.microedition.midlet package. This class defines three life cycle methods for MIDlets. They are 1. pauseApp () this method is called when the MIDlet is passed which releases all shared resources. 2. startApp () this method is called when MIDlet is active and running which acquires any resources it requires to run.

3. destroyApp () indicated that the MIDlet should enter the destroyed state thereby releasing all the shared resources.

Application Management Software (AMS) takes care of MIDlet life cycle and its state transitions which is given by

4. Developing a MIDlet.
The development of a MIDlet is a step by step process which is explained below. a) Add any displayable object(s) which is/are sub class(es) of Displayable class. b) All the sub classes of Item class can be added to Form object which is a Displayable. c) Here the display class acts as a display manager for MIDlet. d) Each MIDlet is initialized with a Display object. e) There can only be one display in action at any one time and user interaction can only be made with the current display. f) The application sets the current display by calling the

Display.setCurrent(Displayable) method. g) Declare the necessary commands for the application like SAVE, EXIT, BACK etc.

h) Define the commandAction method which takes one argument, Displayable. This method is invoked each time an event occurs by executing a command. Define what happens when each type of command is executed. i) Add the commands to the concerned Displayable objects with which the corresponding actions are executed. j) The AMS starts the MIDlet by calling the startApp() method. k) A sample code snippet is given by
import javax.microedition.io.*; import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet; import javax.wireless.messaging.*; public class SendSms extends MIDlet implements CommandListener { Display display; private Command send,exit; /* Declare members */ public SendSms { display=Display.getDisplay(this); /* Intialization */ compose.setCommandListener(this); public void startApp() { display.setCurrent(compose); public void pauseApp() { } } }

public void destroyApp(boolean unconditional) { notifyDestroyed(); }

public void commandAction(Command cmd,Displayable disp) { /* Define what happens when a command is executed*/ } } } } }

5. The Record Management System.


The Record Management System consists of Record Stores which are like databases and Records which are like tables in which data can be stored. A record store consists of a collection of records that will remain persistent across multiple invocations of a MIDlet. Record stores are created in platform-dependent locations, which are not exposed to

MIDlets. RecordStores are uniquely named using the unique name of the MIDlet suite plus the name of the RecordStore. Records are arrays of bytes. All the methods are defined in RecordStore class. Various operations of rms are A new record can be added to RecordStore using addRecord method. Access to the record is closed using closeRecordStore method. deleteRecord is used to delete a record. getNextRecordID gets the record ID of the previously written record. getData returns the data stored in the given record. setRecord sets the data into the given record. openRecordStore opens a record store with the given name.

S-ar putea să vă placă și