Design

The MIDlet launches in an unregistered and offline state. Tapping on the Register button connects the MIDlet to the Notification Enabler, registers it, changes its notification status to Online, and enables it to receive notification messages. Tapping on the Cancel button while connecting to the Notification Enabler cancels the registration. Once the MIDlet is registered and Online, the Get Notification ID button is made available.

Figure: Registering MIDlet with the Nokia Notification Server

Tapping on the Get Notification ID button retrieves the Notification ID from the Nokia Notification Server and displays it on the screen. In this example, the generated Notification ID is used to send notification message from the Nokia Developer Console sending tool.

Note: The generated Notification ID can be copied from the Diagnostics window of the Emulator to paste in the Nokia Developer Console sending tool.

Figure: Getting Notification ID and sending/receiving notification message

Once the MIDlet is registered with the Notification Enabler, it can receive notification information even when the MIDlet is not running. The notification info appears in the notification banner. Tapping on the notification information launches the MIDlet.

Figure: Receiving notification info when the MIDlet is Offline

The MIDlet needs to be registered again to change its notification status to Online and display notification messages received when it was offline. Tapping on the Unregister button unregisters the MIDlet with the Notification Enabler.

Figure: Displaying notification message and unregistering the MIDlet

The MIDlet consists of the following classes:

  • Main—The MIDlet main class.

  • MainView—Implements functionality to register the MIDlet and receive notifications from the Nokia Notification Server.

For source code, see section: MIDlet classes.

For information about implementing the MIDlet, see section: Implementation.