×

React to different error codes

Your MIDlet should react to different error codes as follows:

The different error codes that Nokia Notifications API returns are described in detail in the Client API Javadocs.

The error codes can be classified as follows:

  • Errors that require changes in your MIDlet or service registration

  • Errors that require the end-user to react

  • Errors that do not require actions from your MIDlet or end-user

Errors that require changes in your MIDlet or service registration

The following figures show error cases that require you to make some changes. They are typical in the development phase and guide your development work to the right direction. A change can be related to installation of MIDlets, code change in your MIDlet or something related to your notification service registration.

When your MIDlet is trying to get connected (NotificationSession.registerApplication() called) it may enter to STATE_CONNECTING or STATE_OFFLINE (with error values).

The following state diagram shows how your MIDlet may enter to STATE_CONNECTING or to STATE_OFFLINE state and show which error codes your MIDlet may receive when NotificationSessionListener.stateChanged(NotificationState state) is called by the Notification Enabler.

If you MIDlet enters to STATE_CONNECTING then it receives ERROR_NONE as an error code which means that everything is working so far as expected.

If your MIDlet enters to STATE_OFFLINE then it may get one of these error codes. If you get any of these errors then you need to make some changes as explained below.

ERROR_APPLICATION_ID_CONFLICT — Some other MIDlet has already registered itself with the same Application ID. When you have only one MIDlet with specific Application ID on your device then you will not see this error.

ERROR_NOT_REGISTERED — Some of the following methods is called before the MIDlet is in the STATE_ONLINE:

  • NotificationSession.unregisterApplication()

  • NotificationSession.getReceiveAtLatest()

  • NotificationSession.setReceiveAtLatest(int)

  • NotificationSession.isAudioAlertEnabled()

  • NotificationSession.setAudioAlertEnabled(boolean)

Make these calls only after the MIDlet receives stateChanged(NotificationState state) event as STATE_ONLINE.

When your MIDlet is in STATE_CONNECTING it can get errors that make it go to STATE_OFFLINE. These errors may indicate either that you need to make changes into your code or to your notification service registration. The following state diagram capture shows these error values.

Errors that require the end-user to react

Your MIDlet should guide the end-user to take the appropriate steps to recover from the error situations shown here.

ERROR_DISABLED_BY_USER — This error is reported when state is changed to STATE_OFFLINE. This error is faced when your MIDlet makes a call to NotificationSession.registerApplication() and the end-user has disabled the push notifications from the Notifications MIDlet's settings. You need to implement a note for the end-user to tell that he/she needs to go to the Notification settings and enable the Push Notifications to be able to receive notifications.

ERROR_CONNECTION_DISABLED_BY_USER — This error is caused by your mobile connection not being available because:

  • User has turned OFF WLAN switch and Cellular Data Switch.

  • User has turned ON the Flight Mode.

Errors that do not require actions from your MIDlet or end-user

In this case, the Notification Enabler reports about an error situation but will try to recover itself.

The following error codes report such a situation where no actions are required either from your MIDlet or from the end-user.

Instead, these errors are more like warnings —the Notification Enabler has encountered an error situation and will try to recover.

ERROR_NO_NETWORK — If there is no network connection available or the Notification Enabler has lost the connection to the Notification Server for some other reason. If your MIDlet was online before the error and the connection problem is temporary, then your MIDlet does not need to do anything. This can happen when the user is connected on WiFi and moves out of coverage area into cellular network or the user goes through some area where network coverage is not available like elevators, underground parking area, tunnels etc. The Notification Enabler establishes connection to Notification server automatically when the network connection becomes available again.

ERROR_SERVICE_UNAVAILABLE — This error is reported if the Notification Server is temporarily not available. The Notification Enabler establishes connection to the Notification Server automatically when it becomes available again. Your MIDlet does not need to do anything.

ERROR_AUTHENTICATION_FAILED — When this error condition is returned it means that the device is not able to setup a device account at that moment. Notification Enabler will retry to setup account until it succeeds, and no user action is required.


Last updated 9 October 2013

Back to top

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×