JavaME 01 Overview
JavaME 01 Overview
1
What is it all about?
Java Platform
5
The Java Platform, Part 1 / 3
6
The Java Platform, Part 2 / 3
8
Java?
● In numbers:
> 6 Billion Java-enabled devices
2.6 Billion Java-enabled phones
(8 out of 10 shipped in 2008)
3.5 Billion Java Cards
20 Million Java set-top boxes
800 Million Java desktops
180 Operators deploying Java content
6 Million developers
9
MSA … Mobile Service Architecture (JSRs 248 and 249)
JTWI … Java Technology for the Wireless Industry, JSR 185
MIDP … Mobile Information Device Profile
Java ME
11
Differences J2SE / Java ME (MIDP)
12
Name: J2ME or Java ME?
● Official name:
Java Platform, Micro Edition (Java ME)
● Former name:
J2ME
13
Configuration
17
Profiles – Major Differences
18
Sample Architecture of a Phone
Operating System
19
Java ME – Examples
● Motorola
MOTORAZR V3
CLDC 1.0
MIDP 2.0
20
Java ME – Examples
● Nokia N70
CLDC 1.1
MIDP 2.0
21
Java ME – Examples
● SonyEricsson P990i
CLDC 1.1
MIDP 2.0
CDC 1.0
Personal Profile
22
Java ME – Examples
23
Java ME – Examples
● Amazon Kindle 2
CDC
24
JSRs (Java Specification Requests)
25
JSRs – How Many?
26
JSRs – Games?
27
JSRs – Mapping Applications?
28
„Write Once, Run Anywhere™“ ?
● Problems:
Different screen sizes
Bugs in manufacturers implementations (!)
Different hardware performance
Which JSRs are supported? Bluetooth? SVG? Web services?…
MIDP 2.0 isn’t strict enough:
– Different key codes for every manufacturer (softkeys, ...)
– Are socket connections available?
– Which sound files are playable? Supported image formats?
– Is double buffering supported?
29
JTWI – Fragmentation Solution?
30
Mobile Service Architecture
(MSA, JSR 248)
● Goal?
“Umbrella” specification, replace JTWI
Define a unified platform for majority of handsets
– Spec leds: Nokia, Vodafone. Others heavily involved
● Devices started to ship in 2007
With at least subset of MSA
31
Features in MSA for CLDC
Security & Application Personal
Comms Graphics
Commerce Conectivity Information
JSR 82 JSR 226 2D Scalable
Bluetooth Vector Graphics
JSR 205 JSR 234 Mobile- JSR 224 JSR 211 JSR 179
MMS Messaging media Supplement Payment Content Handler Location
JSR 120 JSR 135 JSR 177 Security & JSR 172 JSR 75
SMS Messaging Mobile Media Trust Services Web Services PIM & File
● High-level goals
Add much-requested functionality over MIDP 2
Rework security model to support CLDC and CDC
– Enables support of MIDP 3 on CDC
Clarify spec and increase implementation consistency
33
MIDP 3.0 Functional Enhancements
● Dynamic Environment
Download new APIs to the handset
Place custom middleware on handset
● Next revision of MSA 248
Supports both CLDC and CDC
Builds upon and requires MIDP 3.0
Adds multi-tasking and on-device service framework
Adds competitive user interface toolkit
Adds device segments: entry, standard, advanced
● No final release date yet
35
JavaFX
36
JavaFX Mobile
38
Internals
Java ME – Applications
39
Code Application
Runtime
Source code (.java)
verification
Compile
Interpreter
(javac)
.jar-file
(MIDlet Suite) Runtime environment
.class-files (KVM)
Packaging
Preverification
.class-files
IDE
40
Preverification
41
MIDlet Suite
42
MIDlet-Suite
Preverified .class-
file(s)
Resources
(icons, graphics –
optional)
Information about
Manifest
.jar
.jad file
.jar-archive (Application
(MIDlet Suite) descriptor, optional)
43
Manifest
Manifest-Version: 1.0
MIDlet-Name: RealReplay
MIDlet-Description: RealReplay
MIDlet-Vendor: Mopius
MIDlet-Info-URL: http://www.mopius.com/
MIDlet-Version: 0.96.20
MIDlet-Icon: /res/icon.png
MIDlet-1:
RealReplay,/res/icon.png,com.mopius.realreplay.RealReplayMIDlet
MicroEdition-Profile: MIDP-2.0
MicroEdition-Configuration: CLDC-1.1
44
Application Descriptor (.jad)
45
Signing
46
Why OTA for Deployment?
47
Over-the-Air
Mobile Device HTTP Web Server
AMS (Application
Notification
Management JAD-Server JAR-Server
Server
Software)
GET /midlet.jad
200 OK
GET /midlet.jar
200 OK
200 OK
48
Optimization – Obfuscation
● Original intention:
Make reverse engineering more difficult
Code more difficult to read after de-compilation
● Renames classes to “a.class, b.class, …”
● Removes unused methods, variables, classes
● Significant size reduction
Over-the-Air = expensive!
MIDlet size restrictions in many phones
Improves speed (less code to load / parse)
49
Obfuscation
Original archive Obfuscated
79,2 kB 42,9 kB = 45% smaller!
50
Developing for JavaME
Example:
Winter Sports
from Digiment
Open Source (GPL)
51
How to develop:
Tools
52
IDEs: Sun NetBeans
53
IDEs: NetBeans
54
IDEs: Eclipse Is integrated in
55
IDEs: Eclipse
57
Sun WTK
Sample application
of NetBeans in the
WTK emulator
58
Manufacturer-Specific Emulators
Motorola
developer.motorola.com/docstools/sdks/
59
J2ME Polish
Event-Handling
61
Events – The Big Picture
62
Listener
63
Commands
Type Description
BACK Navigate to the previous screen (logically)
OK Standard positive answer
CANCEL Standard negative answer, e.g. used for OK & CANCEL
EXIT Exit the application
SCREEN Application specific command, e.g. “Upload”
HELP Request display of help text
ITEM Command is specific for items of the Screen or
for elements of a Choice component
STOP Stop currently running process / task
66
Implementation
Exit e.g. like in the
“Hello World”-
Exercise
● Class HelloWorldMIDlet:
… implements CommandListener
67
Command Handling
68
Exit Softkey
69
2 Softkeys, 3 Commands?
70
That’s it!
71