Java N Amanquah.

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

Java 2D Training. Basic Tools Java SDK 1.4x Wireless Toolkit 2.x NetBeans IDE + mobility pack Global Code editor Text Comparer Tools Graphics Editor Sprite.
Introduction of J2ME Mobile solutions. Overview What is J2ME. How does J2ME work? Java J2ME Carriers and Products. The Two Configuration of J2ME. Profiles.
Multimedia Network Communications Subject:T0934 / Multimedia Programming Foundation Session:13 Tahun:2009 Versi:1/0.
Dirk van Schalkwyk Supervisor: Prof Greg Foster Co-Supervisor: Mrs Madeleine Wright Project Title: A Comparative Study of JME and Flash Lite for Mobile.
J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
J2ME Web Services Specification.  With the promise to ease interoperability and allow for large scale software collaboration over the Internet by offering.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
J2ME RMI 1 Java 2 Platform, Micro Edition Implementation of J2ME RMI Application Farooq Sheikh.
J2ME for Palm Speaker: Chen-Nien Tsai Adviser: Kai-Wei Ke.
Introduction to Mobility Java Technology Mobile and Wireless Networks.
Prepared By E.Musa Alyaman1 Chapter 2 The Java Overview.
J2ME Prepared by: - Gaery- Ronny - Alan- Andy. Why Technology for Mobile Devices? The nature of wireless devices is changing Old devices: All the software.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Developing J2ME Applications Mobile and Wireless Networks.
The 21th century Repairman Agenda Introduction J2EE J2ME Demonstration.
Cosc 4730 Phone Programming in Java An Introduction.
Java 2 Micro Edition Mano Chen Senior Technical Consultant
Java Platform, Micro Edition (J2ME)
J2EE Java 2 Enterprise Edition. Relevant Topics in The Java Tutorial Topic Web Page JDBC orial/jdbc
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Android Introduction Platform Overview.
EclipseME Java Micro Edition The Eclipse Way Craig Setera April 19, 2006.
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley
Platforms and tools for Web Services and Mobile Applications J2ME based Applications Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Getting Started with JXTA for J2ME Advisor : Dr. Ching-Long Yeh Report : DI.2, 洪泰昌 ( ) Course: XML 文件管理.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
Programming Fundamentals 2: Background/ F II Objectives – –give a non-technical overview of Java Semester 2, Background.
Mobile Applications with Java ME & BlackBerry. Overview Java ME –Networking –Databases Java ME and the BlackBerry –The BlackBerry wireless device –Converting.
Framework and application bytecode size CLDC MIDP kXML parser Utility classes Graphics Logic (MIDlet) Application Data (XML file)
Computer Science Wi-Fi App using J2ME and MVC Architecture Advisor : Dr. Chung-E Wang Department of Computer Science Sacramento State University Date:
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
Java 2 Micro Edition (J2ME) and the world of java
1Basics of J2ME. 2 Objectives –Understand the different java API’s and how the mobile edition API’s fit in –Understand what a mobile configuration and.
8-January-2003cse ProjectOverview © 2003 University of Washington1 Project Overview CSE 403, Winter 2003 Software Engineering
Other Popular Java Technologies Internationalization in Java Graphics Programming in Java Security Programming in Java Collections and Data Structures.
© 2002 IBM Corporation Confidential | Date | Other Information, if necessary June, 2011 Made available under the Eclipse Public License v Mobile.
Java 2 Platform, Micro Edition (J2ME)
Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Mobile Programming Mobile Programming - Ordibehesht Ordibehesht 1390.
Introduction to Programming 1 1 2Introduction to Java.
Enhanced mobile services in Java enabled phones Björn Hjelt Sonera zed ltd Supervisor: Professor Jorma Jormakka.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
Visual Mobile Applications with Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
The Java Platform Micro Edition Java ME
Progress Apama Fundamentals
Chapter 1 Introduction to Computers, Programs, and Java
Google Web Toolkit Tutorial
Java Servlets By: Tejashri Udavant..
BlackBerry Application Development
Platform as a Service.
MOBILE DEVICE OPERATING SYSTEM
Processes The most important processes used in Web-based systems and their internal organization.
Jickler Presented To: Core Presented By: Baiju Chandran T
Wireless Instant Messaging Using J2ME
By Jeff Heaton An Overview of J2ME By Jeff Heaton
30 Java Applets.
MIDP Application Security
Introduction of J2ME Mobile solutions.
Java for Mobile Devices
JAVA APPLET PREPARED BY Mr. Jahanzaib Ahmed
Presentation transcript:

Java N Amanquah

Overview The difference between J2ME and MIDP Details from the J2ME stack The J2ME Development Kit Using the Emulator How to Create a Midlet http://dev.widsets.com/wiki/Example_Syndication_Service 2

What is J2ME? J2ME- a resource-constrained JVM and a set of Java APIs for developing applications for mobile devices Different devices have different capabilities J2ME platform is described as a combination of configurations and profiles JVM is preinstalled on mobile 3

J2ME Components J2ME can be divided into three parts: a configuration, a profile, and optional packages. A configuration contains a constrained JVM and some class libraries. A profile builds on top of these base class libraries by providing a useful set of APIs and optional packages. Optional packages are traditionally not packaged by the device manufacturers, and you have to package and distribute them with your application. The configuration and profile are supplied by the device manufacturers and they embedded them in the devices. 4

J2ME Stack Optional Packages Profile Configuration JVM e.g. mobile media API, 3D graphics Profile e.g. MIDP, foundation profile Configuration e.g. CLDC, CDC JVM 5

Popular Configuration and Profile CLDC: Connected Limited Device Configuration The JVM that it provides is very limited and supports only a small number of traditional Java classes. Contrast with CDC MIDP: Mobile Information Device Profile Provides the basic API that is used for creating application Eg javax.microedition.lcdui package for GUI Also: secure networking (https support), multimedia support,more GUI control, a Game API, security mechanisms like code signing and permissions NB: MIDP not for CDC devices. CDC uses profiles like the Foundation and Personal profiles. 6

Abbreviations: MIDP Stack Initial MIDP stack= MIDP1.0+ CLDC 1.0 CLDC (connected limited device configuration) MIDP (mobile information device profile) JTWI stack (java technology for wireless industry) : CLDC1.1+MIDP2.0+WMA 1.1+MMAPI 1.1 WMA=wireless messaging API MMAPI=Mobile Media API

Optional Packages Core MIDP 2.0 APIs are still limited in terms of functionality Device vendors often include additional APIs that sit on top of MIDP and CLDC: JSR-75, FileConnection and PIM JSR-82, Bluetooth API JSR-135, Mobile Media API JSR-120, Mobile Messaging API JSR-179, Location API 8

MIDlets Programs written for the MIDP profile are called MIDlets. A group of related MIDlets can be deployed in the same package called a MIDlet suite. MIDlets constituting the suite can share application data. 9

Using the Emulator Sun Microsystems provides a reference implementation of J2ME called the Java Wireless Toolkit (JWT). Includes an emulator for a standard color phone. 10

Process of MIDlet creation There are seven steps in the creation of a MIDlet: designing coding compiling preverification packaging testing deployment The Toolkit abstracts a lot of these steps so that it is easier for you when you actualy start developing J2ME apps. 11

1. Designing MIDlets are different from other applications that you may have created, simply because MIDlets run in an environment that is very different. With more complex GUI applications it is often best to design the screens (professionally) before starting the actual coding process. Flow, navigation etc 12

2. Code All MIDlets inherit from the abstract javax.microedition.midlet.MIDlet class much like creating an applet by extending the java.applet.Applet class. MIDlet has a few things in common with an Applet: Being downloadable from a remote location Run in a secure environment, where it has very limited means to compromise the device it is running on. 13

Abstract Methods protected void startApp() {} protected void pauseApp() {} protected void destroyApp(boolean unconditional) {} 14

Abstract Methods protected void startApp() {} Called when the MIDlet has been constructed by the VM, and is signaled to start. Most of your initialization goes here. startApp() is also called by the VM after your MIDlet has been paused. So you need to be careful about how you perform your initialization, to avoid allocating resources repeatedly. Eg check if “form” is null Although you can also perform certain initializations in theMIDlet constructor, you have to do all your GUI initialization in startApp(). (The MIDP specification does not guarantee that the GUI (more specifically, the display is available before startApp() is called.) 15

Abstract Methods protected void pauseApp() {} When the MIDlet is required to pause (e.g. if the phone rings), pauseApp() is called. You should release the resources you don’t need when the MIDlet is in the paused state. If the MIDlet itself wants to be explicitely paused (e.g. the user pauses a game), it should first call pauseApp(), followed by a call to notifyPaused(). It is the latter call that notifies the VM that the MIDlet wants to be paused. The VM will not call pauseApp() for you, it assumes it was called before notifyPaused(). 16

Abstract Methods protected void destroyApp(boolean unconditional) {} Called by the VM when it wants to terminate the MIDlet. The flag unconditional indicates whether the MIDlet is required to terminate, or whether it can signal (by throwing an exception) that it can’t be terminated at this time. True= terminate. False=throw exception All resources allocated by the MIDlet should be released properly here. If the MIDlet itself wants to be terminated, it should first call destroyApp(), followed by a call to notifyDestroyed() to signal to the VM that it wants to be terminated. The VM assumes that destroyApp() has already been performed before notifyDestroyed() was called. 17

MIDlet Example import javax.microedition.midlet.MIDlet; public class printerMidlet extends MIDlet { public printerMidlet() { System.out.println("Constructor"); } public void startApp() { System.out.println(“Printing junk"); destroyApp(true); notifyDestroyed(); public void pauseApp() {} public void destroyApp(boolean unconditional) { System.out.println("Destroying printerMidlet"); You can run this on your emulator to see thesystem.out.println messages, but you will not be able to see them on your phone. Copy this code into a file called PrinterApp.java and save it in the folder C:\WTK22\EPROM. 18

Remaining steps.. Preverify (automatically done by toolkit) Compile: Command line: C:\WTK22\EPROM>javac -bootclasspath ..\lib\cldcapi11.jar;..\lib\midpapi20.jar PrinterApp.java Preverify: C:\WTK22\EPROM>..\bin\preverify.exe -classpath ..\lib\cldcapi11.jar;..\lib\midpapi20.jar PrinterApp All steps are done by emulator! Preverify (automatically done by toolkit) See additional notes (hidden slides) Package, (into a jar file) for deployment on mobile Test in emulator 19

20

7. Deploy Local Deployment Deployment Over the Web Bluetooth USB Memory Card Deployment Over the Web Need administrative privileges to be able to modify the configuration files of your web server to add some Multipurpose Internet Mail Exchange (MIME) types for the JAD and JAR extensions. If you are using Jakarta/Tomcat as your web server, you don't need to do this, as it already has these MIME types. For the Apache web server, modify the mime.types file and add the following extension types. text/vnd.sun.j2me.app-descriptor jad application/java-archive jar By adding these MIME types, you are informing the browser, or any client accessing these files from the server, how to handle these files when they are downloaded into the device. 21

7. Deploy Next, create an HTML file that will become the point of reference. Strictly, this is not necessary, because a device that can access an HTML page can also access a JAD file. <HTML> Click <a href=“PrinterApp.jad">here</a> to download PrinterApp MIDlet! </HTML> MIDlet-Jar-URL: http://www.yourdomain.com/j2me/PrinterApp.jar Finally, upload the modified JAD file, the newly created HTML file, and the original JAR file to your web server to a directory location where you will be able to navigate to the HTML page via your mobile device browser. 22

Directory structure Look in bin folder for distribution jar & jad files Look in src folder or apps folder for source files

Deploying MIDlet over Internet Package -> Run via OTA (Over The Air) Creates html file in /bin folder of project. When you install on your server you need to change the hostname from “localhost” to your host name.

MIDlet Lifecycle new(), MIDlets no args contructor AMS startApp() MIDlet Paused MIDlet Active pauseApp() AMS -> Application Management Software, MIDlet’s only software destroyApp() destroyApp() MIDlet Destroyed 26