Read an Excerpt
About this BookTarget Audience
This book targets all mobile software developers and business decision makers. It focuses on end-to-end architectural patterns, best practices, key innovations, and real-world design approaches. For different readers, this book offers different benefits:
- Managers and entrepreneurs: This book is a comprehensive guide to mobile enterprise applications and the Java 2 Micro Edition (J2ME). It covers the capabilities, limitations, common best practices, and commercial solutions of the state-of-the-art mobile Java technologies. It helps you decide which mobile Java profile and products are the best for your business.
- Experienced mobile developers: This book skips the basic MIDP API tutorial materials and goes straight to the more advanced and more useful topics. It uses several complete sample applications to illustrate common architectural patterns and coding best practices in mobile enterprise applications. For developers who are looking for specific solutions (e.g., messaging, database,
- Experienced Java developers: For experienced Java enterprise developers (J2EE developers), the move to mobility is about leveraging existing skills. This book walks through familiar design patterns and best practices and shows developers how to apply them in mobile applications. Lightweight mobile versions of enterprise Java APIs (such as JDBC, Java servlet, JMS, and Java Cryptography Extension) are discussed. Those are excellent examples of how to scale down enterprise solutions for mobility while still preserving core functionalities. With a few notes on mobile-specific issues, it is the fastest pathto add mobility to existing enterprise infrastructure.
To fully understand the technical content in this book, the readers should be familiar with the basic Java 2 Micro Edition, Mobile Information Device Profile (J2ME/MIDP) APIs and development tools. A quick MIDP programming guide is provided in Appendix A.
To run the end-to-end sample applications, you will need to deploy the serverside components to your own Java application server and run the clientside components on the desktop emulator or real devices. Please refer to the product manuals of your tools for step-by-step instructions.
Although serverside Java is not the focus of this book, familiarity with basic Java 2 Enterprise Edition (J2EE) concepts such as servlets, Java DataBase Connectivity (JDBC), Java Messaging Service (JMS), Java
This book is divided into six parts:
- Part I is the introductory material for mobile commerce, mobile enterprise applications, and J2ME. It covers the overall architecture, current status, and future roadmaps of J2ME.
- Part II is the heart of this book. It presents several example applications to illustrate the smart client mobile application paradigm, common architectural patterns, and best practices. It covers how to run container-managed applications (e.g., servlets) on PDA devices. It also presents a useful advanced HTTP client library for J2ME clients.
- Part III is about mobile messaging. In the mobile world, messaging clients are easy to use and fit into the mobile lifestyle. In the enterprise world, messaging is the best way to build loosely coupled applications that have guaranteed quality-of-service (QoS). This part of this book seeks to combine the best of the two worlds. It covers email and SMS-based end-to-end applications as well enterprise mobile messaging servers.
- Part IV discusses mobile databases that are core to occasionally connected and synchronization-based applications. This part covers commercial and open source innovations for mobile databases, synchronization engines, and legacy database connectivity. Two sample database applications from PointBase are presented.
- Part V covers how to integrate mobile clients into the enterprise Web services infrastructure. It discusses existing and emerging J2ME
- Part VI is all you need to know about J2ME mobile security solutions. It goes way beyond the simple connection-based end-to-end solutions such as the HTTPS. This part covers open source and commercial cryptography toolkits for J2ME. Due to the complexity of cryptography APIs, API tutorials for each important toolkit are provided.
- There are two appendices to this book. One of them uses a simple end-to-end MIDP application to illustrate the whole development and deployment cycle. The other appendix introduces the IBM WebSphere Studio Device Developer IDE and provides undocumented instructions on how to install IBM J2ME runtimes on PocketPC devices.
This book uses complete example applications to demonstrate design patterns, best practices, and important API usages. Since this book discusses a wide range of technologies, innovations, and application scenarios, it is impractical to cover everything within a monolithic example. Instead, I decided to develop several small to midsize samples, each focusing on a particular topic. This approach allows the readers to partition the learning task and read one part of this book at a time.
The source code is presented in easy-to-digest segments that are relevant to the discussion text. Nonessential parts of the code (e.g., exception handling, importing packages) are often deliberately omitted from the listings for clarity. Hence, the printed listings are suffcient for understanding the ideas but are not directly runnable code.
- iFeedBack: The grand prize winner of the NexTel/Motorola/Sun wireless application contest in 2002 (Chapter 3).
- Echo: A GUI client and a service running in an OSGi clientside container (Chapter 4).
- Pizza Order: An example included in the IBM Service Management Framework download. It demonstrates how to build smart clients with HTTP front ends (Chapter 4).
- Smart Ticket: The Sun Wireless Blueprints application v2.0 early release code (Chapter 5).
- HttpClient: The code for the advanced HTTP library we develop in this section (Chapter 6).
- Mail: An MIDP email client based on the Mail4ME v1.0 library (Chapter 8).
- WMATester: A simple messaging application that illustrates the use of Wireless Messaging API v1.0 (Chapter 9).
- ContactManager: A mobile address book based on the PointBase v4.5 library (Chapter 11).
- ContactManagerSync: A synchronized mobile address book based on the PointBase v4.5 library (Chapter 13).
- AmazonExample: An k
- PeekAndPick: A RSS reader for mobile phones developed by Jonathan Knudsen (Chapter 15).
- Google: A simple client for the Google Web services API. Both kSOAP v1.2 and v2.0 versions are available (Chapter 16).
- SmartPhrases: An integrated Google search and online dictionary application (Chapter 16).
- MapPoint AxisFacade: An Apache Axis facade for MapPoint v3.0 Web services (Chapter 18).
- MapPoint AxisClient: Personal Profile and MIDP clients for the Map-Point facade (Chapter 18).
- MobileSecurity: A collection of small applications that demonstrate the correct usage of cryptography APIs (Chapter 20).
- SimpleDemo: A simple MIDP application to illustrate key concepts and APIs in MIDP programming (Appendix A).
This book covers and compares more than 30 toolkits and libraries from more than a dozen third-party vendors. The descriptions and API usage examples of those products are intended to give the readers a solid technical ground to make informed comparisons and decisions. They also serve as realworld examples for API and tool designs. However, they do not substitute for the formal product documentation from the vendor. I strongly encourage interested readers to obtain the latest evaluation package and documentation from the vendor to investigate further.Related Publications
Some of the materials used in this book are loosely based on articles I published previously on several online magazines.
- The Sun Smart Ticket blueprint discussed in Chapter 5 is also covered in “End-to-End J2ME Application Development by Example,” published on the Sun Wireless Java Web site in June 2003.
- The first half of Chapter 9 is also covered by “Mobile P2P messaging, Part 1,” published on IBM developerWorks in December 2002.
- Examples in Part IV are adapted from “High-availability mobile applications,” published on JavaWorld in June 2003.
- Chapter 16 is based on “Access Web services from wireless devices,” published on JavaWorld in August 2002.
- The example in Chapter 18 is adapted from “Let the mobile games begin, Part 2,” published on JavaWorld in May 2003.
- Part VI is loosely based on “Data security in mobile Java applications,” published on JavaWorld in December 2002.
This book is produced by the Latex typesetting system on a 1GHz Apple PowerBook running Mac OS X—the best consumer operating system ever produced. Microsoft Word is used for collaborative editing and reviewing. The figures are made with Microsoft Visio, OmniGra2e, GIMP, and the ImageMagick utilities.
The example applications are developed using a variety of development tools, including VI, JEdit, IntelliJ IDEA, and the WebSphere Studio Device Developer IDE. Apache Ant is used to build the applications. Mobile clients are tested on many vendor SDKs, including those from Sun Microsystems (the J2ME Wireless ToolKit), IBM (the WebSphere Micro Environment), Nokia, and Motorola. Real device testing was conducted on Motorola i95cl, Nokia 7210, Nokia 6800, and PocketPC Phone devices.