You are previewing Developing Scalable Series 40 Applications: A Guide for Java Developers.
O'Reilly logo
Developing Scalable Series 40 Applications: A Guide for Java Developers

Book Description

"I have had the good fortune to be involved with mobile Java from the very beginning, and I know what it takes to be successful in this marketplace. This book will help you be successful with mobile Java application design and development. If you take the information inside and sprinkle it with some imaginative application ideas, you will have a winning combination."

— Jon Bostrom, Senior Director, CTO Java Technology Platforms, Nokia

The First Official End-To-End Solutions Guide for Every Nokia Series 40 Developer

Nokia's Series 40 Developer Platform gives Java developers access to the world's highest-volume, fastest-growing, and most exciting mobile markets. Nokia sells close to 100 million units within their Developer Platform families every year, and the Series 40 Developer Platform is the highest-volume platform in the family. Success on this platform is crucial for the commercial success of any mobile application. Knowledge of the Series 40 Developer Platform can be applied to the Java environment on all Nokia Developer Platform devices, including Series 60 devices.

Fully reviewed by Nokia's subject matter experts, this book covers the entire development process—from design and coding through testing and deployment. The authors walk you through eleven complete example applications, presenting downloadable client and server source code that you can use to jump-start virtually any project. Along the way, the authors illuminate the technical underpinnings of Series 40, review crucial architectural issues, introduce key mobile design patterns, discuss scalability and device optimization strategies, and offer dozens of best practices and tips—many of which have never before been published.

Coverage includes

  • Identifying your best opportunities and killer applications for mobile development

  • Building effective MIDP 2.0 user interfaces for devices built on the Series 40 Developer Platform

  • Building animated mobile games

  • Handling persistent and networking data

  • Proven techniques for scaling and optimizing applications across devices

  • © Copyright Pearson Education. All rights reserved.

    Table of Contents

    1. Copyright
    2. Nokia® Mobile Developer Series
    3. Foreword
    4. 1. Mobility Explained
      1. The Freedom Economy
        1. Mobile Advantages
          1. Extreme Personalization
          2. Information Access Anytime, Anywhere
        2. Application Areas
          1. Business-to-Consumer Applications
          2. Business-to-Business Applications
          3. Business-to-Employee and Workplace Automation Applications
          4. Government and Public Services Applications
        3. The Technology Diffusion Curve
        4. Mobile Value Chains
      2. Mobile Killer Applications
        1. Mobile Entertainment
        2. Mobile Enterprise
      3. Developer Skill Migration
        1. Migration Paths
          1. Java Server-side Developers
          2. Java Desktop Developers
          3. Visual Basic Corporate Developers
        2. Mobile Application Design Concerns
          1. Mobile Device Characteristics
          2. Mobile Network Characteristics
        3. Social Design Considerations
      4. Summary
    5. 2. Introducing Nokia Developer Platforms
      1. Open Standard Mobile Technologies
      2. Nokia Developer Platform Architecture
        1. Series 40 Developer Platform
          1. Software Stack
          2. Device Characteristics
          3. User Interface
        2. Series 60 Developer Platform
        3. Series 80 Developer Platform
        4. Series 90 Developer Platform
        5. Other Nokia Device Series
      3. Pervasive Client Technologies: WAP and MMS
        1. Introducing WAP
          1. Network Architecture
          2. WML
          3. XHTML MP
        2. Introducing MMS
          1. SMIL
        3. The Thin-Client Application Paradigm
      4. Managed Smart-Client Technology: J2ME
        1. A Brief History of Java
          1. From WORA to Java Everywhere
        2. The J2ME Architecture
        3. MIDP and Its Optional Packages
        4. The Smart-Client Paradigm
      5. Tightly Integrated Smart-Client Technology: Symbian C++
        1. The Evolution of Symbian OS
        2. Symbian OS Architecture
      6. Get Connected
        1. Leading Platforms
        2. Developer Resources
        3. Business Generation
      7. Summary
    6. 3. Getting Started
      1. Introducing the MIDlet
        1. MIDlet Life Cycle
          1. The Background and Foreground UI States
        2. Accessing the AMS
        3. MIDlet UI Basics
      2. The Photo Viewer Example: Life Cycle
        1. Starting and Running the MIDlet
          1. Code Walkthrough
        2. Exiting the MIDlet
          1. Code Walkthrough
        3. Automatically Start MIDlets via the Push Registry
      3. The Photo Viewer Example: Thread and Timer
        1. Why Multi-threading?
        2. The TimerTask
        3. The Timer Class
      4. Preparing the Tools
        1. Nokia Developer’s Suite for J2ME
          1. Install the NDS for J2ME
          2. A Quick Tour of the NDS
          3. Install Device SDKs
          4. Inside the SDK
        2. Apache Ant
        3. Integrated Development Environments
          1. Borland JBuilder
          2. The Sun Java Studio
          3. Eclipse
      5. Building the Photo Viewer MIDlet
        1. A Step-by-Step Tutorial
          1. Compiling
          2. Preverifying
          3. Copying Resource Files
          4. Packaging
          5. The JAD File
          6. Test and Run the MIDlet Suite in Emulator
        2. Automated Build with Ant
      6. Over-the-Air Provisioning
        1. OTA Process Overview
        2. The Server Setup
        3. The MIDlet Attributes
          1. Required MIDlet Attributes
          2. Optional Informational MIDlet Attributes
          3. Push-Related MIDlet Attribute
          4. Security-Related MIDlet Attributes
          5. Notification and Reporting MIDlet Installation Events
          6. Nokia Specific MIDlet Attribute
        4. Other Provisioning Options for Nokia Phones
          1. Cables
          2. Bluetooth
          3. Infrared Port
      7. Summary
    7. 4. MIDP User Interface
      1. The Design of the MIDP UI API
        1. The UI Models
          1. The High-Level API
          2. The Low-Level API
        2. Architecture of the LCDUI
          1. Display
          2. Displayable
          3. Command
        3. A Sample Application
      2. The High-Level API
        1. Screen
          1. List
          2. Alert
          3. TextBox
          4. Form
        2. Item
          1. StringItem and ImageItem
          2. TextField and DateField
          3. ChoiceGroup
          4. Gauge
        3. Customizing the Behavior of Items
          1. Item Commands
          2. Item State Changes
      3. The Low-Level API
        1. Graphics
          1. Fonts
        2. Key-Event Model
        3. Canvas in Action
          1. The Movable Text
          2. Animation
      4. Advanced MIDP UI Concepts
        1. Advanced Device Controls
        2. Command Placement
        3. Item Layout Management
        4. Transparency and Pixel-Level Image Manipulation
          1. ARGB Image Data Format
          2. Convert Image to or from ARGB Array
          3. The Graphics.drawRGB() Method
          4. Using Part of an Image for Drawing
        5. The CustomItem
        6. Use a Splash Screen
        7. Virtual Canvas Space
        8. Wrap Text on Canvas
        9. Background MIDlet on Series 60 Devices
        10. MIDP UI Designer in Nokia Developer’s Suite
      5. Nokia UI API Extensions
        1. FullCanvas
        2. DeviceControl
        3. DirectUtils
        4. DirectGraphics
      6. Summary
    8. 5. Developing Action Games
      1. Basic Game Concepts
        1. The Game MIDlet
        2. Thread for the Game Loop
      2. The Game API Package
        1. GameCanvas
          1. The GameCanvas Graphics Buffer
          2. Full-Screen Mode
          3. Reading Player Input
          4. The readInput() Method Implementation
          5. Suppress Unnecessary Callbacks
        2. Layer
          1. The Fish Class
        3. Sprite
          1. Collision Detection
          2. Using Collision Detection
          3. Sprite Animation
          4. Positioning and the Reference Pixel
          5. Sprite Transforms
          6. Animating the Fish
        4. TiledLayer
          1. Animated Tiles
          2. Animating the Background
        5. LayerManager
          1. Drawing the Game World to the Display
      3. Improving the Fish Game
        1. Regulating the Animation Speed
          1. A Further Discussion of Frame Rate Issues
        2. Multiple Game Loops
          1. High Frequency Sampling
          2. Discrete Event Simulation
        3. Starfish
        4. Adding Manta Rays
      4. Additional MIDP 2.0 Enhancements
        1. Transparency and Pixel Arrays
        2. Backlight
      5. Summary
    9. 6. Handling Application Data
      1. Introduction to Data Persistence
        1. The Volatile RAM
        2. Local Persistent Memory
        3. Remote Storage
        4. Photo Viewer with Comments
      2. Java Objects Serialization
        1. Communication Classes
        2. Serialize the Photo Attributes
      3. RecordStore
        1. Manipulate the RecordStore
        2. Manipulate Records
        3. Store ImageAttribute Data
        4. RecordStore Listeners
      4. Browsing and Searching the RecordStore
        1. RecordEnumeration
        2. RecordFilter
        3. RecordComparator
        4. Search and Sort in Photo Viewer
      5. Summary
    10. 7. Data Connectivity
      1. Introduction to the Generic Connection Framework
        1. Connector
        2. HttpConnection
        3. HttpsConnection
        4. SocketConnection
        5. SecureConnection
        6. ServerSocketConnection
        7. CommConnection
        8. UDPDatagramConnection
      2. Networked Photo Viewer
        1. PhotoServlet
        2. PhotoViewer
        3. FetchWorker
      3. Nonblocking UI Designs
        1. Noninteractive Gauge
        2. Still-Image Transit Screen
        3. A More Reliable Image Transit Screen
        4. Animated Transit Screen
      4. Stateful Network Operations
        1. HTTP Cookies
        2. PhotoServlet
        3. SessionConnector
        4. FetchWorker
      5. The HttpClient Utility
        1. The Framework
        2. Use HttpClient and Handlers
      6. HTTPS and Secure Connections
        1. How HTTPS Works
        2. HttpsConnection and SecureConnection
        3. SecurityInfo and Certificate
      7. Summary
    11. 8. Wireless Messaging
      1. Messaging in Smart Clients
      2. Wireless Messaging API
        1. TextMessage and BinaryMessage
        2. MessageConnection
        3. Sending and Receiving Messages
        4. Security
        5. Message Listener in Push Registry
      3. The Chat Example Application
        1. Run the Example
        2. Send Messages
        3. Receive Messages
      4. New Features in WMA 2.0
        1. The Connection URL String
        2. MultipartMessage and MessagePart
      5. Summary
    12. 9. Multimedia
      1. Introduction to the MMAPI
        1. The Manager Class
          1. Create Player from URI Locators
          2. Create Player from Data Stream and MIME Type
          3. Create Player from DataSource
          4. Other Manager Methods
          5. System Properties
        2. Player
          1. Player Life Cycle
          2. PlayerListener
          3. Other Methods in the Player Interface
        3. Control
      2. Simple Audio Playback
        1. The MidiPlayer MIDlet
        2. Create the Player
        3. Player Events
        4. Player Controls
          1. VolumeControl
          2. StopTimeControl
          3. TempoControl
          4. RateControl
          5. PitchControl
          6. MIDIControl
      3. Advanced Media Playback
        1. Initializing Players in a Thread
        2. Play Back wav Audio Files
        3. Play Back Video Files
          1. Play Back Video on a Form
          2. Play Back Video on a Canvas
      4. Media Capture
        1. Capture Image
        2. Capture Audio
        3. Submit Blog Entries
        4. The Blog Servlet
      5. Summary
    13. 10. The Bluetooth API
      1. Introduction to Bluetooth Wireless Technology
        1. Piconets
        2. Bluetooth Control Center
        3. Security
        4. The Bluetooth Protocol Stack
        5. Profiles
        6. The Inquiry Procedure
        7. Class of Device and Service Discovery
      2. Java API for Bluetooth
        1. Bluetooth Initialization
        2. Bluetooth Connections
          1. Server Connection
          2. Client Connection
          3. Connection URL Parameters
        3. Device Management and Discovery
          1. Get Information about the Local Device
          2. Discover Devices in the Network
          3. Get Information about Remote Devices
        4. Service Management and Discovery
          1. Service Records
          2. Register Service for Server Connections
          3. Discover Services
        5. Put Them Together
          1. Server
          2. Client
      3. An Example Bluetooth Application
      4. Nokia Development Tool Support
      5. Summary
    14. 11. End-to-End Design Patterns
      1. Introduction to the Trivia Game Example
        1. Feature Overview
        2. Backend Database Setup
      2. Overall Architecture
        1. Screen-Switch in Mobile Applications
        2. What Is the MVC Pattern?
        3. The View Screens
        4. The Controller
        5. The Model
      3. Object Management
        1. Static Class
          1. Stateful Static Class
          2. Static Class That Requires Initialization
        2. Factory Methods
          1. Singleton
          2. Select from Multiple Implementations
          3. Select Implementation at Runtime
        3. Object Pools
        4. Implement a Back Screen Stack
      4. Thread Management
        1. WorkerRunnable
        2. WorkerThread
        3. WaitScreen
        4. A Concrete Worker Thread Implementation
      5. Network Integration
        1. RPC Protocol
          1. On the Mobile Client Side
          2. On the Server Side
        2. Synchronization
          1. On the Client Side
          2. On the Server Side
        3. Web Service Gateway
          1. On the Client Side
          2. On the Server Side
      6. Summary
    15. 12. Developing Scalable Applications
      1. Develop and Optimize
        1. Screen Characteristics
        2. Memory Constraints
          1. JAR Size Limit
          2. Heap Memory
          3. RMS Space
        3. API Availability
        4. Protocol Availability
          1. The MMAPI
          2. The GCF
        5. Behavior of UI Components
        6. Thread Behavior
        7. Languages and Cultures
      2. Replaceable Modules
        1. Customized JAD Files
        2. Resource File Modules
        3. Source Code Modules
          1. Replacing Part of a Class
      3. Preprocessing and Postprocessing with Antenna
        1. Introducing Antenna
          1. Installing Antenna
          2. Antenna Tasks
        2. Preprocessing
          1. Preprocessor Directives
          2. Examples of Directive Usage
          3. The wtkpreprocess Task
        3. Postprocessing
          1. Smart Linking
        4. Bytecode Obfuscation
        5. The build3.xml File
      4. Summary
    16. 13. Debugging and Testing
      1. Debugging
        1. Basic Techniques
        2. On-Device Logging with MIDPLogger
      2. Unit Testing
        1. Assert
        2. TestCase
        3. TestSuite
        4. TestRunner
      3. UI Testing Guidelines
      4. Summary
    17. 14. Multimedia Messaging Service
      1. Messaging Services
        1. MMS Benefits and Opportunities
        2. The MMS Infrastructure
        3. MMSC Access
        4. MMS Application Modes
          1. Peer-to-Peer Messaging Mode
          2. The Terminating Mode
          3. The Originating Mode
          4. The Originating-Terminating Mode
      2. Authoring MMS Messages
        1. Nokia Device Characteristics for MMS
        2. A Quick Introduction to SMIL
          1. The SMIL Document Structure
          2. The Playback Control Elements
          3. The Media Elements
          4. Layout Management
          5. A Music Slide Show Example
        3. Nokia Developer’s Suite for MMS
      3. Nokia Mobile Server Services Library
        1. Instantiating the Driver
          1. Using the Nokia API
          2. Using the SAMS API
        2. Connection Configuration
          1. Using the Nokia API
          2. Using the SAMS API
        3. Sending Messages
          1. Simple Messaging with Nokia API
          2. SMIL Message with Nokia API
          3. SMIL Message with SAMS API
          4. SMS Message with SAMS API
        4. Receiving Messages
          1. Using the Nokia API
          2. Using the SAMS API
      4. Summary
    18. 15. Browser Applications
      1. Browser Applications
        1. The Thin-Client paradigm
        2. The WAP Infrastructure
          1. The WAP and HTTP Stack
          2. The Wireless Profiled TCP/IP Stack
      2. Authoring Mobile Browser Content
        1. Nokia Device Browsers
        2. WML Versus XHTML MP
          1. How About WMLScript?
        3. Content Download and Upload
        4. Nokia Browser Developer Tools
      3. Advanced WAP Features
        1. Push
          1. Service Indication
          2. Service Loading
        2. Wireless Telephony Applications Interface (WTAI)
          1. Making a Phone Call
          2. Sending a DTMF Tone
          3. Adding a Phone Book Entry
        3. Wallet
      4. Summary