Skip Headers
Oracle® Java Micro Edition Software Development Kit Developer's Guide
Release 3.2 for Eclipse on Windows
  Go To Table Of Contents
Go To Index


21 JSR 211: Content Handler API (CHAPI)

JSR 211 defines the Content Handler API (CHAPI). The basic concept is that MIDlets can be launched in response to incoming content (files). Modern mobile phones can receive content using SMS, infrared, Bluetooth, e-mail, and other methods. Most content has an associated content type. CHAPI specifies a system by which MIDlets can be launched in response to specific types of content.

21.1 Using Content Handlers

In the Oracle Java ME SDK Content Handlers are integrated in an Eclipse project as application descriptors. Content Handlers you define are packaged with the application.

21.2 Running the CHAPIDemo Content Browser

This demo is a content browser that takes advantage of the content handler registry. It enables you to view different types of content from different sources.


For the demo to work this project must reside in the Java ME SDK installation's \apps subdirectory. You must create this directory yourself.

  1. If your workspace is the Java ME SDK installation's \apps subdirectory, continue to step 2. If not, follow these steps to create the workspace:

    • Create an \apps directory in your Java ME SDK platform installation. For example, C:\Java_ME_platform_SDK_3.2\apps.

    • In Eclipse, select File > Switch Workspace > Other.

    • Browse to the \apps directory, and click OK.

  2. Select File > New >Project... and in the New Project window, select Examples > Java ME SDK 3.2 > Java ME Sample Applications, and click Next.

    Choose CHAPIDemo.

  3. Run the project.

  4. On the Favorite Links page, choose CHAPI Demo.

  5. Press Select or choose the menu soft button and choose Go.

    The Text Viewer displays a Media Player URL and links to various media files.

  6. Install the Media Player to view media.

    • Click the URL http:handlers/MediaHandler.jad, or, use arrow keys to highlight the URL and from Menu, select Go.

    • The application asks, "Are you sure you want to install Media Handler?" Click the Install soft key.

      An authorization Information screen is displayed.

    • Press the Install soft key.

      The installation is confirmed. When the installation completes, you are returned to the Text Viewer. The Media Handler is shown as a separate application in the AMS.

  7. Select and view the different image, video, audio and text URLs.

    Click on a link to open that media in the viewer, or, use arrows to highlight the link, then select Go from the soft menu.

    Select the Back soft key to return to the Text Viewer.