Mobile Application Development 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 application to different J2ME mobile phones IMVS, Ch. Denzler 2 1
Content Development & Compiling Packaging Deploying Porting Device Fragmentation Design for Portability IMVS, Ch. Denzler 3 Overview: Development & Development Installation Editing javac Cell Phone Service Provider enter URL download.jad preverify Internet download.jar jar install & verify obfuscate copy on Webserver run (KVM) IMVS, Ch. Denzler 4 2
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 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. This saves computation time on the mobile device IMVS, Ch. Denzler 6 3
Packaging 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 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 Renders bytecode unreadable IMVS, Ch. Denzler 8 4
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 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. Emulator (Vendor specific) IMVS, Ch. Denzler 10 5
Manifest / Application Descriptor 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) IMVS, Ch. Denzler 11 JAD file properties JAD File Content MIDlet-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 which implements that MIDlet IMVS, Ch. Denzler 12 6
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: value pairs) The JAD file allows the device s application manager to decide whether the MIDlets can be executed on the device. IMVS, Ch. Denzler 13 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 IMVS, Ch. Denzler 14 7
Fragmentation Mobile device fragmentation limits mobile application adoption 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 IMVS, Ch. Denzler 15 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 applications IMVS, Ch. Denzler 16 8
Java ME: De-fragmentation The problem More 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 => Design Guidelines IMVS, Ch. Denzler 17 9