Example: Creating an OBEX connection

This example MIDlet shows you how to create a simple application for exchanging business cards over Bluetooth using the OBEX API.

The MIDlet is typically used as follows: When the users start the MIDlet for the first time, they select their own card from the address book. When two users meet, they both start the MIDlet, which exchanges their business cards. New business cards are saved in the phone book of each device.

Note: The device must have at least one contact (business card) in the phone book for the MIDlet to run correctly. The business cards are delivered directly to the application (not to the Inbox). Therefore, sending business cards to a device requires that the MIDlet is running on it.

Figure: BCExchanger MIDlet

Prerequisites

You need the following to develop and test this MIDlet:
  • Series 40 5th Edition SDK or newer

  • Series 40 5th Edition device or newer

For instructions on how to get started with Java ME, see section Getting started.

Development

For more information about the MIDlet, see:

  • Design for information about the design and functionality of the MIDlet

  • Implementation for instructions on how to implement the MIDlet

You can download the project files for the MIDlet from the download page.