Retrieve an incoming notification

Your MIDlet should retrieve an incoming notification as follows:

  1. Your MIDlet needs to create a session with Notification Enabler by calling the method NotificationSessionFactory.openSession(). The method returns an object reference of class NotificationSession. Now your MIDlet can be used for Nokia Notifications API calls.

  2. Your MIDlet should now call the method NotificationSession.registerApplication() to make your MIDlet go to STATE_ONLINE. When your MIDlet is in STATE_ONLINE, it is able to receive notifications from the Notification Enabler and call most of the methods in Nokia Notifications API.

The following sequence diagram shows how the MIDlet uses the Nokia Notifications API classes to retrieve an incoming notification from the Notification Enabler.

  1. The MIDlet opens the session to the Notification Enabler to be able to use the Nokia Notifications API.

  2. The NotificationSessionFactory method creates a new instance of the NotificationSession.

  3. The NotificationSession is created.

  4. The MIDlet calls NotificationSession.registerApplication method to make the MIDlet registered to receive notifications.

  5. If there are incoming notifications then the Notification Enabler calls NotificationSessionListener.messageReceived method with argument NotificationMessage that includes the content of the notification. This call back method is called once for every incoming notification.