Home > Articles

  • Print
  • + Share This
This chapter is from the book

Managed Smart-Client Technology: J2ME

J2ME brings rich and high-availability applications to occasionally connected mobile devices. It is universally supported by all versions of Nokia Developer Platforms as well as all other major mobile handset manufacturers. In this introductory chapter, we have a high-level overview of J2ME.

A Brief History of Java

The Java technology is emerging as one of the most important enablers for mobile applications. In 2007, Java handset shipments will reach more than 450 million, constituting 74 percent of all handset shipments. Java mobile devices will soon surpass Wintel PCs and become the dominant information access clients. Nokia is a major player in the Java landscape. The technical benefits of Java include:

  • Crossplatform: This is very important in the diverse mobile device market. For example, the same J2ME MIDP application runs on all Nokia Developer Platform devices with relatively small amount of modification, representing huge cost savings for developers.
  • Robust: Since Java applications run in a managed environment, the bytecode is verified before execution, and unused objects are reclaimed by garbage collectors (see the tip). Even if a Java application does crash, it is contained within the virtual machine. It will not affect other applications on the device.
  • Secure: The Java runtime provides advanced security features through a domain-based security manager and standard security APIs.
  • Object oriented: The Java language is a well-designed, object-oriented language with vast library support. There is a vast pool of existing Java developers.
  • Wide adoption at the backend: It is relatively easy to make Java clients work with Java application servers and messaging servers. Due to the wide adoption of Java 2 Enterprise Edition (J2EE) on the server side, J2ME is the leading candidate for end-to-end mobile applications.

From WORA to Java Everywhere

For early Java, the term crossplatform has a strict meaning: the same bytecode application should run without modification on any computer that has a Java runtime. The original vision is that Java-based software agents could roam over the network automatically. That not only requires bytecode compatibility but also runtime library compatibility. But as Java evolves, it is used in many different application scenarios. The single class library approach no longer fits the needs.

Recognizing that one size does not fit all, the Java 2 Platform is divided into three editions. The Java 2 Standard Edition contains the basic JVM and core class libraries; the Java 2 Enterprise Edition provides additional class libraries and tools for enterprise server applications; the Java 2 Micro Edition consists of stripped-down virtual machines (called KVMs&8212;Kilobyte Virtual Machines) that can run on devices with kilobytes of memory. For mobile devices, a subset of the standard edition class library and new libraries for mobile-specific tasks. It is clear that a Java bytecode application written for an enterprise server will not run crossplatform on a PDA device without modification.

In June 2003, during the eighth JavaOne conference in San Francisco, Sun Microsystems brought up a new slogan for Java: "Java Everywhere." The emphasis is no longer on direct portability of bytecode applications. The focus now is to provide the same language, consistent architectures, and similar APIs across all computing platforms. Java Everywhere allows developers to port their skills to new application arenas.

The J2ME Architecture

The separation of J2EE, J2SE, and J2ME is a step in the right direction. However, a single monolithic J2ME is still too inflexible for mobile devices. There is a huge variety of mobile devices, designed for different purposes and with different features. For example, applications on an automobile-mounted system are much more complex than those on a cell phone. Even among similar devices, such as high-end and low-end cell phones, portability can cause underutilization of resources on one device and strain on another. Device manufacturers and developers need fine-grained API differentiation among devices, not the "lowest common denominator."

To balance portability with performance and feasibility in the real world, J2ME contains several components known as configurations, profiles, and optional packages (Figure 2-15). Each valid combination of a configuration and a profile targets a specific kind of device. The configurations provide the most basic and generic language functionalities. The profiles sit on top of configurations and support more advanced APIs, such as a graphical user interface (GUI), persistent storage, security, and network connectivity. The optional packages can be bundled with standard profiles to support specific application needs.

02fig15.gif

Figure 2-15 The J2ME architecture.

The two most important J2ME configurations are as follows.

  • The Connected Limited Device Configuration (CLDC) is for the smallest wireless devices with 160KB or more memory and slow 16/32-bit processors. The CLDC has limited math, string, and I/O functionalities, and lacks features such as the Java Native Interface (JNI) and custom class loaders. Only a small subset of J2SE core libraries is supported by the CLDC virtual machines (KVMs). The most recent version of the CLDC is version 1.1. It was developed by the JSR 139 and released in March 2003.
  • The Connected Device Configuration (CDC) is for more capable wireless devices with at least 2MB of memory and 32-bit processors. Unlike the CLDC, the CDC supports a fully featured Java 2 virtual machine and therefore can take advantage of most J2SE libraries. The CDC 1.0 was developed by the JSR 36, and it became available in March 2001. The new CDC 1.1 is currently being developed by the JSR 218 and is expected before the end of year 2004.

Important J2ME profiles include the following. The Mobile Information Device Profile (MIDP) is built on top of the CLDC to provide support for smart phones; the Foundation Profile is built on top of CDC to provide support for networked embedded devices; the Personal Basis Profile (PBP) and Personal Profile (PP) are built on top of the CDC and the Foundation Profile to provide support for GUI-based powerful mobile devices such as high-end PDA devices. The standard UI library in the current PBP and PP editions is the Java AWT (Abstract Widget Toolkit).

On the CDC and Personal Profile stack, important optional packages include the following: the RMI (Remote Method Invocation) Optional Package (JSR 66) supports remote object sharing between Java applications; the JDBC (Java DataBase Connectivity) Optional Package (JSR 169) provides a uniform interface to access structured query language (SQL) databases from Java applications; the Advanced Graphics Optional Package (JSR 209) aims to add Swing and Java 2D API libraries into the CDC/PP stack.

Although CDC and PP have their places in the mobile market, they are not nearly as popular as the MIDP. All major mobile device manufacturers, including Nokia, are committed to support MIDP. In the next section, we take a deeper look at MIDP and its optional packages.

MIDP and Its Optional Packages

The most important and successful J2ME profile is the CLDC-based MIDP. The MIDP targets the smallest devices, such as smart phones. It is already deployed on millions of handsets, including all Nokia Series 40 and 60 devices. Hence, the MIDP is a key technology that all Nokia developers need to learn.

An MIDP application consists of a suite of MIDlets. Each MIDlet can be independently installed, started, paused, and stopped by the application management software (AMS) on the device. The AMS can be controlled by the user, using the phone keypad. The MIDlet API specification provides a set of abstract life-cycle methods that hook into the AMS. Developers must implement these methods to specify the runtime behavior of each MIDlet. The code for a minimal MIDlet that displays a Hello World string on the screen is as follows. The details of the code are explained in Chapter 3, "Getting Started."

package com.buzzphone.hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloMidlet extends MIDlet {

  Form form;

  // Called by the AMS when the MIDlet is instantiated
  public HelloMidlet () {
    form = new Form ("Hello");
  }

  // Called by the AMS when it starts the MIDlet
  protected void startApp() {
    form.append ("Hello World");
  }

  // Called by the AMS when it stops the MIDlet
  protected void destroyApp(boolean unconditional) {
    destroyApp(false);
    notifyDestroyed();
  }

  // Called by the AMS when it pauses the MIDlet
  protected void pauseApp() {
  }
}

As of late 2003, most mobile phones in the market support the MIDP 1.0 specification. However, the MIDP 1.0 lacks some important features, such as security and advanced UI controls. As a result, device vendors often supply their own MIDP extensions to provide advanced custom features. Vendor-specific extensions undermine the portability of J2ME applications. Many problems with the MIDP 1.0 have been fixed in the MIDP 2.0, which came out of JCP in August 2002. The Nokia Developer Platforms 2.0 for Series 40 and 60 mandate MIDP 2.0 and optional packages on new Nokia phones.

Table 2-1 lists MIDP-compatible optional packages. Most of the MIDP optional packages run on CDC profiles as well. Nokia supports the optional packages at different levels:

  • Device available: The optional package is already factory-installed on some Nokia devices.
  • Coming soon: Device implementation of the optional package is currently being developed by Nokia engineers. It will be available on new devices soon.
  • Specification: The optional package specification is still being developed by the JCP. Nokia supports that specification by contributing to the expert group.
  • No plan: Nokia currently has no plan to support this optional package on its devices.

Table 2-1. MIDP Optional Packages

Name

JSR

Nokia Support

Description

File I/O and PIM

75

Device available

This optional package has two modules: the file I/O module supports access to file systems on a PDA device; the PIM module allows the MIDP application to integrate with the device's native PIM clients.

Mobile Media

135

Device available

Provides audio and video capture and playback APIs. The exact supported media formats vary by devices. It is covered in detail in Chapter 9.

Wireless Messaging

120/205

Device available

Provides an API for the MIDP application to send and receive SMS and MMS messages. It is covered in detail in Chapter 8.

Location

179

Coming soon (1H2005)

Supports location tracking for devices. The location information can come either from a GPS device module or from the network carrier.

Web Services

172

Coming soon

Provides XML APIs for generic XML parsing as well as SOAP Web Services clients.

Bluetooth

82

Device available

Supports access to Bluetooth data channels and protocol libraries from an MIDP application. It is covered in detail in Chapter 10.

Security and Trust

177

Coming soon (1H2005)

Allows MIDP applications to interact with the phone's embedded security module such as the SIM card for GSM phones.

3D Graphics

184

Device available

Provides an API to display 3D scenes on a mobile device. A lightweight mobile 3D data format for the art works is also defined.

Content Handler

211

Coming soon (1H2005)

Allows devices to associate MIME types with MIDlet applications. Media files with certain MIME types will be automatically opened by the associated MIDlet.

Scalable 2D Vector Graphics

226

Coming soon (1H2005)

Provides capability to render 2D vector images in the SVG (Scalable Vector Graphics) format.

SIP (Session Initiation Protocol)

180

Coming soon (1H2005)

Provides support for SIP-based communication. It will allow data to be pushed to mobile devices.

Presence and IM

165/187

No plan

Supports presence and instant messaging applications based on the SIP.

Data Sync

230

Specification

Supports synchronizing PIM databases over the network. This optional package also provides APIs to process most common PIM data formats.

The Smart-Client Paradigm

Microbrowser-based thin-client technologies were instrumental in bringing mobile Internet to masses in the early days of mobile commerce. But WAP-based mobile commerce has never taken off due to the poor usability on the client side. The new generation of smart-client and mobile middleware technology (e.g., J2ME and Microsoft's .NET Compact Framework) promises to bring feature-rich clients to mobile applications. The benefits of smart clients over thin clients include the following:

  • Smart clients have richer and more pervasive user interfaces. In particular, the judicial use of threads can drastically improve user perception of the application performance.
  • Smart clients can be more easily personalized. Extreme personalization is one of the most touted benefits of the freedom (mobile) economy.
  • On-device data storage reduces network traffic, especially unnecessary round trips. It enables transactions; supports the "offline" mode when the network is temporarily unavailable; and hence improves overall performance, reliability, and availability of mobile applications.
  • Smart clients can leverage device extensions. For example, a smart-client program can talk with the device's built-in (or attached) GPS module and barcode scanners. A smart client can also integrate with device-specific software (e.g., email and messaging clients) to improve the user's workflow.
  • Smart clients support more powerful and flexible security schemes. They enable content-based security and distributed single sign-on.
  • Smart clients support advanced integration technologies. They are easy to plug into existing corporate infrastructure. Supports for asynchronous messaging and XML Web Services are crucial for reliable and maintainable mobile solutions.
  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020