Mobile Application Development
Deployment
Development Process and Portability
Christoph Denzler
University of Applied Sciences Northwestern Switzerland Institute for Mobile and Distributed Systems
Learning Target
You
know of what steps the deployment process
consists for a MIDlet application
are aware of the fragmentation problems in the
J2ME market
can apply some strategies to this problem
know how to develop and deploy the same
Deployment IMVS, Ch. Denzler 3
Development & Deployment
Compiling Packaging Deploying
Porting
Device Fragmentation Design for Portability
Overview : Development & Deployment
Editing javac preverify jar obfuscate copy on Webserver download .jad download .jar install & verify run (KVM) enter URL Cell Phone Service Provider Internet Development Installation
Compiling
javac -bootclasspath
../../lib/cldcapi10.jar; ../../lib/midpapi20.jar
-d tmpclasses -source 1.3 -target 1.1
src/hello/HelloMIDlet.java
bootclasspath loads requested libraries source indicates language compatibility target indicates byte code compatibility d destination folder is tmpfolder
Deployment IMVS, Ch. Denzler 5
Preverify
preverify -classpath ../../lib/cldcapi10.jar;
../../lib/midpapi20.jar -d classes tmpclasses
classpath lists necessary libraries-d destination folder
Verifies byte code.
jar cfm bin/Hello.jar bin/MANIFEST.MF
-C classes .
cfm: creates a jarfile with the given manifest. Note m
and f must be in the same order that jarfile and manifest appear
-C: directory with the compiled and preverified
classes
Deployment IMVS, Ch. Denzler 7
Obfuscation
java -jar ../../bin/proguard.jar
-libraryjars ../../lib/cldcapi10.jar;
../../lib/midpapi20.jar
-injars bin/Hello.jar -outjar /deploy/Hello.jar
-keep "public class * extends
javax.microedition.midlet.MIDlet "
ofuscates all injars and produces an outjar does not obfuscate terms in -keep
Minimize memory footprint by
Installation
OTA (over the air)
.jad file is downloaded and its content will be
presented to the user.
User decides to proceed.
.jar file is downloaded and application will be
installed.
Direct transfer from PC (usually only Windows)
Either wireless (Bluetooth, IrDA)
USB cable
Deployment IMVS, Ch. Denzler 9
Development Process & Tools
1. Develop the source code files.
Any texteditor
2. Compile the source code files into bytecode classes.
Standard Java Compiler (javac)
3. Pre-verify the bytecode classes (Off-Device Pre-verification) midlet classes must be verified prior to distribution to guarantee that
they don´t perform any illegal operations.
Reason: limitations of the virtual machine used in mobile devices
J2ME toolkit (WTK, JME SDK)
4. Package the bytecode classes into a Jar-file with any additional resources and a manifest file.
Java archive (jar) tool
5. Develop a Java Application Descriptor file (Jad-file) to accompany the Jar-file.
Generated and/or using texteditor
6. Test and debug the midlet.
Deployment IMVS, Ch. Denzler 11
JAR Manifest
MIDlet-Name: Hello World MIDlet-Version: 1.0.0 MIDlet-Vendor: LOGIQUEST
MIDlet-Description: Hello World Demo MIDlet-Icon: img/hello.png
MIDlet-Data-Size: 0
MIDlet-1: Hello, img/hello.png, hello.HelloWorld
MicroEdition-Profile: MDIP-1.0 MicroEdition-Configuration: CLDC-1.0
Java Application Descriptor (JAD) MIDlet-Name: Hello World
MIDlet-Version: 1.0.0 MIDlet-Vendor: LOGIQUEST
MIDlet-Description: Hello World Demo MIDlet-Icon: img/hello.png
MIDlet-Data-Size: 0 MIDlet-Jar-Size: 1251 MIDlet-Jar-URL: hello.jar
User-defined entries can be read with the MIDlet method String getAppProperty(String key)
JAD file properties
JAD File ContentMIDlet-Name MIDlet-Version MIDlet-Vendor
MIDlet-<n> for each MIDlet MIDlet-Jar-URL
MIDlet-Jar-Size
The MIDlet-<n>property specifies the name of the MIDlet and an icon (for selecting the MIDlet to be run), and the name in the JAR file of the class whichDeployment IMVS, Ch. Denzler 13
Packaging MIDlets
One or more MIDlets are packed in a “MIDlet Suite”:Java class files, other resources (images etc.) and a Manifest, in
a JAR file,
A Java Application Descriptor (JAD) file describing the MIDlets
(and largely repeating the Manifest), in the form of Java properties (key: valuepairs)
The JAD file allows the device’s application manager todecide whether the MIDlets can be executed on the device.
Porting and Testing Application
Porting and testing applications is very time
consuming since there are differences between
different phone models such as:
Screen size Memory Processor Bugs Operator problems Specification divergence
Deployment IMVS, Ch. Denzler 15
Mobile device fragmentation limits mobile applicationadoption and thereby Carriers’ ARPU (average revenue per user) growth
Different hardware Different API support
Different standards: MIDP, DoJa, BlackBerry, etc. Different interpretations of standards
Device bugs
Example: Design problems
The mobile Java standard only allows limited
design of applications, unless every detail is
drawn by the application itself
Standard implementations do not allow to influence
the CI and look and feel of the application
Adapting designs to different environments or
customers is difficult
Design changes require changing the source code of
Deployment IMVS, Ch. Denzler 17
Java ME: De-fragmentation
The problemMore than 600 J2ME device types
It is expensive to develop, test and sign, deliver and maintain Ever increasing operational costs
Commercial "failure" of the J2ME platform
The solution:De-fragmentation
Possible due to increased capabilities of the devices Improved programming techniques