Writing your first midlet running java on a cell phone
Download
1 / 29

Writing Your First MIDlet Running JAVA on a Cell Phone - PowerPoint PPT Presentation


  • 176 Views
  • Uploaded on

Writing Your First MIDlet Running JAVA on a Cell Phone. Jon A. Batcheller January 27, 2004. Overview. The MID The CLDC & MIDP API Developing Code Emulation Deployment. MID – Mobile Information Device. Cell Phones, Palms, Blackberry…. Pocket Fisherman?

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Writing Your First MIDlet Running JAVA on a Cell Phone' - africa


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Writing your first midlet running java on a cell phone l.jpg

Writing Your First MIDletRunning JAVA on a Cell Phone

Jon A. Batcheller

January 27, 2004


Overview l.jpg
Overview

  • The MID

  • The CLDC & MIDP

  • API

  • Developing Code

  • Emulation

  • Deployment


Mid mobile information device l.jpg
MID – Mobile Information Device

  • Cell Phones, Palms, Blackberry….

  • Pocket Fisherman?

  • JAVA = one program, multi-platforms

  • “similar platforms” - WORA


Slide4 l.jpg
MIDP

Reduced JVM

  • J2ME – Java 2 Mobile Edition

  • CLDC – Connected Limited Device Configuration

  • CDC – Connected Device Configuration – full JVM imp.

  • MIDP – Mobile Information Device Profile

  • Personal Java, Embedded Java, JavaPhone


Slide5 l.jpg
MIDP

JAVA MIDP Apps

MIDP

CLDC

Native Apps

MID Native (SYMBIAN OS)

MID


Slide6 l.jpg
CLDC

  • 128K to 512K total memory

  • Limited Power

  • Limited Connectivity (9600bps)

  • Reduced UI

  • Cell Phones, Pagers, PDA’s


Slide7 l.jpg
MIDP

  • API and virtual machine to device domain

  • java.lang

  • java.util

  • java.io

  • javax.microedition.io

  • javax.microedition.lcdui

  • javax.microedition.rms

  • javax.microedition.midlet


Development tools l.jpg
Development Tools

  • Sun Micro – J2ME Wireless Toolkit

  • MIDP 1.0.3

  • Borland & Sun Forte

  • Nokia – Standalone & JBuilder attachment

  • Need environment to compile (library), verify, package, emulate, and finally deploy


Writing our first midlet l.jpg
Writing our first MIDlet

  • Application written for the MIDP Profile

  • Must derive from javax.microedition.midlet.MIDlet

  • Must implement startApp(), pauseApp() and destroyApp()

  • Typically also implement a default constructor and a commandAction() from the CommandListener interface



Hellomidlet java l.jpg
HelloMIDlet.java

  • Extends MIDlet

  • Implements startApp, pauseApp, destroyApp

  • Like an Applet, need something and somewhere to display

  • Display .vs. Displayable

  • Foreground .vs. Background

  • Current Displayable


Hellomidlet java12 l.jpg
HelloMIDlet.java

  • Extends MIDlet

  • Implements startApp, pauseApp, destroyApp

  • Like an Applet, need something and somewhere to display

  • Display .vs. Displayable

  • Foreground .vs. Background

  • Current Displayable


Display object l.jpg
Display Object

  • Displayable current = Display.getDisplay(this).getCurrent();

  • Returns current Displayable

  • Typically in startApp(), look for current Displayable, if null, create own and set it as current.


Helloscreen l.jpg
HelloScreen

  • Displayable current = Display.getDisplay(this).getCurrent();

  • Returns current Displayable

  • Typically in startApp(), look for current Displayable, if null, create own and set it as current.


Hellomidlet java15 l.jpg
HelloMIDlet.java

  • Compile

  • Note project library

  • Package

  • Emulate

  • Deploy

  • Test


Package l.jpg
Package

  • JAD

  • Versions – JAD, CLDC, MIDP

  • Multiple MIDlets – Suites

  • Other Classes

  • Other Files

  • JAR


Jad java application descriptor l.jpg
JAD – Java Application Descriptor

  • Usually a link on a WAP site

  • Info on the MIDlet

  • Most Important – URL of the JAR

  • Downloaded to MID then user queried to download JAR


Jad java application descriptor18 l.jpg
JAD – Java Application Descriptor

MIDlet-Name: HelloWorld

MIDlet-Version: 0.0.1

MIDlet-Vendor: Solidware, Inc

MicroEdition-Profile: MIDP-1.0

MicroEdition-Configuration: CLDC-1.0

MIDlet-Jar-URL: HelloWorld.jar

MIDlet-Jar-Size: 1592

MIDlet-1: HelloWorldApp, , HelloWorldApp


Deploy l.jpg
Deploy

  • JAD first

  • JAR on request

  • Methods

    • IR

    • BlueTooth

    • Email

    • WEB – “Over the Air”

      http://www.javac.com/index.wml


Emulate l.jpg
Emulate

  • Emulators – part of toolkits – Sun or Phone

  • http://developers.sun.com/techtopics/mobility/midp/articles/emulators

  • Debugging Environment

  • Interesting Behaviors


Slide21 l.jpg
Test

  • Test

    • Download jad

    • Queries user if new or different version

    • Download jar

    • Execute Application

  • Review Application details


Propexample java l.jpg
PropExample.java

  • Review Code

  • Emulators

  • Test


Javax microedition lcdui l.jpg
javax.microedition.lcdui

  • MIDP Low & High-level APIs

Displayable

Screen

Canvas

Alert

Form

List

TextBox


Javax microedition lcdui24 l.jpg
javax.microedition.lcdui

  • Contents of Form and Alert Screens

Item

ChoiceGroup

DateField

Gauge

ImageItem

StringItem

TextField


Uidemo java l.jpg
UiDemo.java

  • Look and Feel

  • Bejeweled


Javax microedition io l.jpg
javax.microedition.io

  • CLDC – HTTP protocol!

  • Connection object

  • Content, Datagram, HTTP, Stream

  • Normal Stream I/O

    • Open with URL

    • Get input/output streams

    • Read/Write

    • Close


Javax microedition io27 l.jpg
javax.microedition.io

  • HttpExample.java

  • Log & Server2.java


Javax microedition rms l.jpg
javax.microedition.rms

  • Named record store

  • Access to byte array records

  • Add, Get, Store

  • Stock Ticker


Writing your first midlet running java on a cell phone29 l.jpg

Writing Your First MIDletRunning JAVA on a Cell Phone

And the discussion continues at McMenamin’s Greenway Pub, 12272 SW Scholls Ferry Road

North on 217 next exit, then West


ad