Vous êtes sur la page 1sur 12

J.E.N.I.

Chapter 1
Mobile Application Development
1.1 Objectives
In this chapter, we will discuss the characteristics of mobile devices, and how it influence the
development program for this device. We will be introduced the Java 2 Mobile Edition (J2ME),
including the importance of configuration and profile.
At the end of the lesson, the student should be able to:

Identify the characteristics of mobile devices

Describe the J2ME architecture

Know the role of configurations and profiles

Identify the APIs provided by MIDP

Describe the MIDlet life cycle

1.2 Mobile Devices


Mobile device has many kinds in terms of size, design and layout, but they share
characteristics very different from desktop systems.

Small in size
Mobile device has a small size. Consumers want the smallest device for their convenience
and mobility.

Limited memory
The mobile device also has a small memory, namely primary (RAM) and secondary (disk).
This restriction is one of the factors that influenced the writing program for various types
of these devices. With restrictions on the amount of memory, special considerations must
be taken to maintain the use of this expensive resource

Limited processing power


A mobile system that is not as tough as their desktop counterparts. Size, technology and
costs are some of the factors that affect the status of these resources. As hard disk and
RAM, you can find them in sizes that fit with a small package.

Low power consumption

Pengembangan Perangkat Mobile

J.E.N.I.

Mobile devices spend less power compared to a desktop machine. This device should save
power because they run on the circumstances in which limited power provided by the
batteries.

Robust and reliable


Because mobile devices are always brought anywhere, they must be strong enough to
face collisions, movements, and occasional droplets of water.

Limited connectivity
The mobile device has a low bandwidth, some of them do not even connected. Most of
them use a wireless connection.

Short wakeup time


These consumer devices start up in seconds most of these are always on. Try to take the
case of a mobile phone, they boot in seconds, and most people do not turn off their mobile
phones even when the evenings. PDA will light up if you press the power button them.

1.3 J2ME Overview


1.3.1 JAVA Platform
Java was made in 1991 by James Gosling. Initially named Oak, where in honor of the tree outside
Gosling's window. Later the name was changed to Java because there has been a language named
Oak.
The actual motivation of Java is the need for a language that can be used on a variety of platforms
that can be incorporated into a variety of electronic products such as toaster and fridge. One of
the first projects developed JAVA using a remote control that is named Star 7.
At the same time, the World Wide Web and the Internet is growing very fast. Gosling realize that
Java can be used for Internet programming.
With the release of version 1.2, the Java platform has been broken down into several editions:
The Standard Edition (J2SE), Enterprise Edition (J2EE), Mobile Edition (J2ME), and JavaCard API.

J2SE Java 2 Platform, Standard Edition

Desktop applications

J2EE Java 2 Platform, Enterprise Edition

Enterprise applications with a focus on


webserver side development, including
servlet, JSP, EJB, and XML

J2ME Java 2 Platform, Micro Edition

Mobile devices

JavaCard

Smart Cards

Pengembangan Perangkat Mobile

J.E.N.I.

Servers
Desktop
machines
High-end
consumer
devices

Optional
Packages
Optional
Packages

Low-end
consumer
devices
Smart
Cards

J2EE
J2SE

Personal Profile
Foundation Profile

MIDP

CDC

CLDC

Java
Card

KVM

Card VM

Java Virtual Machine

Java 2 Micro Edition (J2ME)

Figure 1: Java

Platform

1.3.2 J2ME Overview


J2ME is a set of specifications and technologies that focus on consumer devices. This device has
a limited amount of memory, spend a little power from the battery, the small screen and low
network bandwidth.
With the proliferation of mobile consumer devices from phones, PDAs, game box to home
appliances, Java provides an environment that is portable to develop and run applications on this
device.
J2ME program, like all programs are translated by JAVA VM. Programmed the compiled into
bytecode and translates premises Java Virtual Machine (JVM) .This means that these programs
are not directly related to the device. J2ME provides an interface that corresponds to the device.
These applications do not have to be compiled again to be able to run on different machines.
Lies in the core of J2ME configuration and profiles. A configuration describes the basic runtime
environment of a system J2ME. He describes the core library, virtual machines, and network
security features.

Pengembangan Perangkat Mobile

J.E.N.I.

Applications
Profile
Configuration

Optional
OEM
Packages
APIs
Libraries
{
Java Virtual Machine

Device Operating System

Figure 2: J2ME

Architecture

A profile provides additional libraries for a particular class at a device. Profile-profile provides a
user interface (UI) API, persistence, messaging library, etc.
A set of additional libraries or additional package provides the ability to program additional. This
package entered into J2ME devices may vary as depending on the capabilities of a device. For
example, some devices MIDP does not have Bluetooth built-in, so the Bluetooth API is not
provided in this device.

1.3.3 Configuration
A minimal configuration describe the features of a complete Java runtime environment. To ensure
portability and interoperability capabilities between different optimal kinds of devices are limited
resources (memory, processor, connections are restricted), configuration no describe features
additional. Something configuration J2ME describes a minimum complement of JAVA technology.
It is a profile-profile task to describe the additional libraries for a category of devices certain.
Configuration illustrates:

the subset of the Java programming language

the functionality of the Java Virtual Machine (VM)

core platform libraries

security and networking features

Pengembangan Perangkat Mobile

J.E.N.I.

1.3.4 Profiles
A profile defines additional sets of APIs and features for a particular market, device category or
industry. While a configuration defines the base libraries, profiles define the libraries that are
important to make effective applications. These libraries include the user interface, networking,
and storage APIs.

1.4 CLDC
The Connected Limited Device Configuration (CLDC) describes and refers to the area the
following:

Java language and Virtual Machine (VM) features

Core libraries (java.lang.*, java.util.*)

Input/Output (java.io.*)

Security

Networking

Internationalization

1.4.1 Missing features


This particular feature of J2SE, which moved from CLDC are:

Finalization of class instances

Asynchronous exceptions

Some error classes

User-defined class loaders

Reflection

Java Native Interface (JNI)

Thread groups and daemon threads

Reflection, Java Native Interface (JNI) and user-defined class loaders potential into breach
security. JNI also require intensive memory so it is possible to not the support of the lower
memory a mobile device.

1.4.2 CLDC Device Characteristics


Devices targeted by CLDC has the following characteristics:

At least 192kb of memory for Java platform (160kb non-volatile memory for VM and
libraries and 32kb volatile memory for VM runtime).

16 or 32 bit processor.

Pengembangan Perangkat Mobile

J.E.N.I.

Low power consumption (usually battery powered).

Limited, intermittent network connection with limited bandwidth (usually wireless).

CLDC does not describe the installation and life cycle of an application, interface (UI) and event
handling (event handling). It is the mission profile which are under CLDC to describe this area.
In particular, the MIDP specification describes the cycle life MIDP application (MIDlet), UI library
and event handling (javax.microedition.lcdui. *).

1.4.3 Class Verification


CLDC specification requires all classes to pass the verification process at two levels. The first
verification conducted outside the device prior to the installation on the device. Verification The
second occurred on the device during runtime and executed by the KVM.

File.java

compile (javac)

Install
verify
(runtime)

File.class
preverify

interpret

File.class

Development Machine
Figure 3: Two Levels

Pengembangan Perangkat Mobile

Target Device
Process Verification

J.E.N.I.

1.4.4 Generic Connection Framework


The Generic Connection Framework API provides the basis for the connection in the CLDC. This
framework provides a common foundation for connections such as HTTP, Socket, and Datagrams.
GCF provides a set of APIs that common and ordinary separating all type of connection. It should
be noted that not all types of connections needed to be implemented by MIDP devices.
Hierarchy of interfaces that can be expanded from GFC make the leveling process becomes
maybe. New type of connection may be added to this framework to expand this hierarchy.

Connection

StreamConnectionNotifier

DatagramConnection

InputConnection

OutputConnection

StreamConnection

ContentConnection

Figure 4: Hierarchy GCF

connection

1.5 CDC
Connected Device Configuration (CDC) is a super set of the CLDC. CDC provides Java runtime
environment that is broader than the CLDC and closer to J2SE environment.

Pengembangan Perangkat Mobile

J.E.N.I.

CDC Java Virtual Machine (CVM) fully supports the Java Virtual Machine (JVM). CDC lists all of
the CLDC API. CDC provides a larger subset of all class J2SE.
As CLDC, CDC does not describe every class UI. UI Library is described by profile- profile under
this configuration.
All classes contained in the CDC comes from this package:

java.io

java.lang

java.lang.ref

java.lang.math

java.net

java.security

java.security.cert

java.text

java.util

java.util.jar

java.util.zip

CDC also incorporated inside the GCF. CDC requires additional connection types such as file and
support datagram.

1.6 JTWI
The Java Technology for the Wireless Industry (JTWI) establishes a set of services and
specifications standard. Based JTWI specification, the key word is "to minimize fragmentation API
in in market telephone mobile, and for send specification that could predictable, clear specification
for the plant, operators and application developers."
With adjustments to JTWI, many applications will run in a broader set on the device. The device
will also plant lucky because a large application will be available for their devices.

Pengembangan Perangkat Mobile

J.E.N.I.

MIDlets
MIDP 2.0

WMA
1.1

MMAPI Optional
1.1
Packages

OEM
APIs

CLDC 1.0 or 1.1


Device Operating System

Figure 5: JTWI Components

1.7 MIDP
The Mobile Information Device Profile (MIDP) was on top of the CLDC. You cannot write mobile
applications using only the CLDC API. You must keep utilize MIDP defines the UI.
Specifications MIDP, CLDC and most other APIs such as already illustrated through Java
Community Process (JCP). JCP involves a group of experts from more than 50 Companies, which
consists of a mobile device manufacturer, software developer. MIDP continue developing, with
future versions that have passed rigorous process JCP.
MIDP specification describes a MID device that has characteristicsThese characteristics as a minimum:

Display:
Screen-size: 96x54
Display depth: 1-bit
Pixel aspect ratio: approximately 1:1

Input:

One or more of the following user-input mechanisms: one-handed keyboard,


two-handed keyboard, or touch screen

Memory:
256 kilobytes of non-volatile memory for the MIDP implementation, beyond what's
required for CLDC.
8 kilobytes of non-volatile memory for application-created persistent data
128 kilobytes of volatile memory for the Java runtime (e.g., the Java heap)

Networking:
Two-way, wireless, possibly intermittent, with limited bandwidth

Sound:
The ability to play tones, either via dedicated hardware or via software algorithm.

Pengembangan Perangkat Mobile

J.E.N.I.

Describe MIDP application model, UI API, storage and strong networks, games and media APIs,
security policies, application deployment and provision of over-the- water.

1.8 MIDlet
A MIDP application is called a MIDlet. The device's application management software (AMS)
interacts directly with the MIDlet with the MIDlet's create, start, pause, and destroy methods.
The MIDlet is part of the javax.microedition.midlet package. A MIDlet must extend the MIDlet
class. It can request parameters from the AMS as defined in the application descriptor (JAD).
A MIDlet does not have (and MUST NOT have) a public static void main(String[] argv) method.
It will not be recognized by the AMS as the program's starting point.

1.8.1 MIDlet Life Cycle


MIDlet life begins when instantiated by the AMS. Originally signed MIDlet status "Pause" after the
newly created command. AMS call a public constructor with no arguments from MIDlet. If an
exception occurs in the constructor, the MIDlet enters the status "Destroyed" and dispose of it
immediately.

MIDlet into the status "Active" on the startup method call () by AMS.
MIDlet into the status of "Destroyed" when AMS destroyApp invoke (). This status also reaccessed when method notifyDestroyed () returned successfully to the application. Note that the
MIDlet can only enter the status of "Destroyed" once in their lifetime.

Pengembangan Perangkat Mobile

10

J.E.N.I.

new
destroyApp()

startApp()

Paused

Destroyed
Active

pauseApp()

destroyApp()

Figure 6: MIDlet Life Cycle

1.8.2 MIDlet suites


MIDlet applications are packaged and sent into the device as MIDlet suites. A MIDlet suite consists
of a Java Archive (JAR) and an additional Java Application Descriptor (JAD).
JAD file is a text file that contains a set of attributes, some are needed.

1.9 Exercises
1.9.1 What are the advantages of using Java as the development and
platform runtime for mobile devices??

Applications are very portable

Rich, illustrated by connecting to devices

Low memory usage (KVM)

Secure runtime environment

dynamic applications

Pengembangan Perangkat Mobile

11

J.E.N.I.

1.9.2 What motivated you to write programs for mobile device?

The challenge of optimizing writing applications

New learning experience

Pleasure factors

Pengembangan Perangkat Mobile

12

Vous aimerez peut-être aussi