Docsity

Java ME MIDlets and CLDC: Lifecycle, Packaging, and Security, Study notes of Mobile Computing

Partial preview of the text

Download Java ME MIDlets and CLDC: Lifecycle, Packaging, and Security and more Study notes Mobile Computing in PDF only on Docsity!

Lecture 3

Java ME โ€“ More About MIDlets and

CLDC

S.Kapetanakis & Markus A. Wolf

Based on material from Gill Windall

1 Application Development for Mobile Devices

Contents What happens when a MIDlet runs? Packaging and deploying a MIDlet Passing properties to MIDlets MIDlet security CLDC

Markus A. Wolf Application Manager MIDlet lifecycle (1) public class LifeCycle1 extends MIDlet { public LifeCycle1() { System.out.println("I'm being born"); } protected void startApp() { System.out.println("I'm being started"); } protected void pauseApp() { System.out.println("I'm being paused"); } protected void destroyApp(boolean param) { System.out.println("I'm being destroyed - aargh"); } } create MIDlet start MIDlet pause MIDlet destroyMIDlet LIfeCycle1.java^4

MIDlet lifecycle (2) active state startApp() (^) pauseApp() destroyed state destroyApp() destroyApp() paused state constructor garbage collected

Quick Quiz Question 1 Which of the following are true statements? By the time a MIDlet's constructor has finished executing the MIDlet will be in the active state. The Application Manager is piece of software written in Java that you download from Sun if you want to run MIDlets on a portable device. A possible sequence of calls to a MIDlet's lifecycle methods is: constructor, startApp(), pauseApp(), startApp(), destroyApp()

Contents What happens when a MIDlet runs? Packaging and deploying a MIDlet Passing properties to MIDlets MIDlet security CLDC

packaging the MIDlet suite MIDlets are deployed in MIDlet suites A MIDlet suite is a collection of MIDlets plus configuration information It consists of: an application descriptor (a JAD file) a JAR file containing the MIDlet .class file(s) and a manifest file MIDlet suite MyMidletSuite.jad MyMidletSuite.jar MyMidlet.class MANIFEST.MF

Packaging a MIDlet suite with

Java WTK

Converting to PRC format PRC (Palm ResourCe) is a format that allows MIDlets to be installed on PalmOS devices like native PalmOS applications The IBM WebSphere Micro Environment Palm OS Developer ToolKit Jar to PRC tool will create a PRC file from a JAD/JAR file

Installing PRC on PalmOS device

Use the standard Palm Quick Install

application from a PC

drag and drop the PRC into the Quick Install application on the PC Hotsync from the PalmOS device

Example of OTA deployment 1 2 3

Contents What happens when a MIDlet runs? Packaging and deploying a MIDlet Passing properties to MIDlets MIDlet security CLDC

Setting and retrieving properties Extract from MIDlet code private String city = "sydney"; private String country ="australia"; public TempInSydney_v2() { โ€ฆโ€ฆ. city = getAppProperty("city"); country = getAppProperty("country"); } JAD file MIDlet-1: TempInSydney, , temperature.TempInSydney_v MIDlet-Jar-Size: 100 MIDlet-Jar-URL: MoreMidletsEgs.jar MIDlet-Name: MoreMidletsEgs MIDlet-Vendor: Unknown MIDlet-Version: 1. MicroEdition-Configuration: CLDC-1. MicroEdition-Profile: MIDP-2. city: lusaka country: zambia (^19)

Contents What happens when a MIDlet runs? Packaging and deploying a MIDlet Passing properties to MIDlets MIDlet security CLDC