Connected Limited Device Configuration and Mobile Information Device Profile ( CLDC and MIDP )

Chapter 3 - Security both CLDC and MIDP

    Connected Limited Device Configuration and Mobile Information Device Profile ( CLDC and MIDP )

  •           Connected Limited Device Configuration (CLDC)is for devices with limited configurations.only 128 to 512KB of memory available for Java applications.

              The JVM that it provides is very limited and supports only a small number of The Connected Device Configuration (CDC) is for devices.

              The MID profile used the CLDC configuration very well because it minimizes both the memory and power required for limited devices. It provides the API that is used for creating application for devices.

    MIDlet Creation:

              There are seven steps in the creation of a MIDlet. These steps are: designing,coding, compiling, preverification, packaging, testing, and deployment.Every application needs to be designed, coded, and compiled.

    Step 1: Design

              MIDlets are different from other applications that can be created,because MIDlets run in an environment that is very different.Interactivity of MIDlet with the user.

    Example: An application Date-Time MIDlet does not need user interactivity.It needs to display the current date and time for a few seconds when the user executes the MIDlet.

              So It can be used to design the MIDlet by drawing it on a piece of paper and also designs with multiple screens, it is best to design the screens before starting the actual coding process.

    Step 2: Code

              MIDlet must extend the abstract MIDlet class found in thejavax.microedition.midlet package, much like creating an appletby extending the java.applet.Applet class.

              MIDlet must override three methods of this abstract class, startApp(),pauseApp(), and destroyApp.

    Example:

    DateTimeApp class:
    package com.j2me.part1;
    
    import java.util.Date;
    
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.Display;
    import javax.microedition.midlet.MIDlet;
    
    public class DateTimeApp extends MIDlet {
    
      Alert timeAlert;
    
      public DateTimeApp() {
        timeAlert = new Alert("Alert!");
        timeAlert.setString(new Date().toString());
      }
    
      public void startApp() {
        Display.getDisplay(this).setCurrent(timeAlert);
      }
    
      public void pauseApp() {
      }
    
      public void destroyApp(boolean unconditional) {
      }
    } 

              DateTimeApp's constructor creates the element that is use to display the time on a screen and the startApp method does the actual task of displaying this element.

    Step 3: Compile

              Compiling MIDlets is not very much different from compiling normal Java applications. use javac as the compiler,except to change the boot CLASSPATH while compiling MIDlets.

              Effect of changing the base Java classes that the Java compiler uses to compile MIDlet.So instead of compiling against the java.lang.Date in java API,use J2ME's java.lang.Date.

              This is done by pointing to the CLDC and MIDP classesfor javac's -bootclasspath option while compiling.

    DateTimeApp MIDlet compilation:

              Enter the command by navigating to the directory C:\WTK22\article

    command prompt:
    C:\WTK22\article>javac -bootclasspath ..\lib\cldcapi11.jar;..\lib\midpapi20.jar 
      com\j2me\part1\DateTimeApp.java
    

© 2015 by Learncertification All Rights Reserved. The certification names are the trademarks of their respective owners. Terms & Privacy Policy