Mobile Application Development: 1.1 Objectives
Mobile Application Development: 1.1 Objectives
Mobile Application Development: 1.1 Objectives
Chapter 1
Mobile Application Development
1.1 Objectives
In this chapter, we will discuss the characteristics of mobile devices, and how it influence the
programming development for this device. We will be introduced to 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:
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 programming 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
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.
Limited connectivity
The mobile device has a low bandwidth, some of these are not even connected. Most of
them use a wireless connection.
Desktop applications
Mobile devices
JavaCard
Smart Cards
Servers
Optional
Packages
Desktop
machines
High-end
Low-end
consumer
consumer
devices
devices
Optional
Packages
Smart
Cards
J2EE
Personal Profile
J2SE
Foundation Profile
MIDP
CDC
CLDC
Java
Card
KVM
Card VM
Figure 1:
Java Platform
Applications
Profile
Configuration
Optional
OEM
Packages
APIs
Libraries
{
Java Virtual Machine
Figure 2:
J2ME Architecture
A profile provides additional libraries for a particular class at a device. Profiles provides a user
interface (UI) API, persistence, messaging library, etc.
A set of additional libraries or additional package provides the ability to add program. 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 on limited resources (restricted memory, processor,
connections) capabilities between different optimal kinds of devices, configuration describes no
additional features. The J2ME configuration describes a minimum complement of JAVA
technology. It is a profiles task to describe the additional libraries for a category of certain
devices.
Configuration illustrates:
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 following area:
Input/Output (java.io.*)
Security
Networking
Internationalization
Asynchronous exceptions
Reflection
Reflection, Java Native Interface (JNI) and User-defined class loaders might breach security. JNI
also require intensive memory so it is not possible to support the lower memory a mobile
device.
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.
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. *).
File.java
Install
compile (javac)
verify
(runtime)
File. class
prev
erify
interpret
class
File.
Development Machine
Figure 3:
Target Device
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.
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.
For CLDC, CDC does not describe every class UI. UI Library is described by profiles 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 on JTWI specification, the keyword is "to minimize fragmentation
API in mobile telephone market, and for predictable send specification, clear specification for the
manufacturers, operators and application developers."
With adjustments to JTWI, many applications will run in a broader set on the device. The device
will also make manufacturers better because a large application will be available for their
devices.
MIDlets
MIDP 2.0
WMA
1.1
MMAPI Optional
1.1
Packages
OEM
APIs
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 that defines the UI.
MIDP, CLDC specifications and such as most other APIs are 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 continues to develop,
with future versions that have passed rigorous process JCP.
MIDP specification describes an MID device that has these minimum characteristics:
Display:
Screen-size: 96x54
Display depth: 1-bit
Pixel aspect ratio: approximately 1:1
Input:
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:
Sound:
The ability to play tones, either via dedicated hardware or via software algorithm.
MIDP application model describes, UI API, storage and strong networks, games and media APIs,
security policies, application deployment and provision of over-the- air.
1.8 MIDlet
An 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.
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.
10
new
destroyApp()
startApp()
Paused
Destroyed
Active
pauseApp()
destroyApp()
Figure 6:
1.9 Exercises
1.9.1 What are the advantages of using Java as the development and
platform runtime for mobile devices??
Dynamic applications
1
1
Pleasure factors