Handle incoming notification state changes

Your MIDlet should handle incoming notification state changes as follows:

This diagram shows how your MIDlet's state is changed in an optimal case (no actual error cases shown in this diagram).

The MIDlet can be in three different states:

  • STATE_OFFLINE

  • STATE_CONNECTING

  • STATE_ONLINE

Your MIDlet needs to have a session to be able to interact with the Notification Enabler. When a session has been opened with the call NotificationSessionFactory.openSession() the next step is to get your MIDlet go into STATE_ONLINE with the call NotificationSession.registerApplication().

Note:

The MIDlet needs to be in STATE_ONLINE to be able to call most of the Nokia Notifications API methods other than NotificationSessionFactory.openSession(), NotificationSession.registerApplication() and NotificationSessionFactory.close().

Your MIDlet's method NotificationSessionListener.stateChanged(NotificationState state) gets called by the Notification Enabler every time the state is changed.