Your MIDlet can register for notifications as follows:
NotificationSession.registerApplication() call role is two-fold:
First time when NotificationSession.registerApplication() is called, the Notification Enabler establishes a connection with the Notification Server and registers the MIDlet with its Application ID and Service ID. Your MIDlet is now ready to receive notifications from Notifications Server.
A few important things to remember with registerApplication() are:
The registration remains active even though the MIDlet is not actively running.
If the notification arrives (on device) while the MIDlet is running, the Notification Enabler will deliver the received notification directly to the MIDlet.
If the notification arrives (on device) while the MIDlet is NOT running, the Notification Enabler will store that notification.
When the MIDlet is launched next time (either by clicking on notification item visible on the notification drawer or by clicking the MIDlet icon from the apps grid) it can fetch the stored notification(s) by calling the NotificationSessionFactory.openSession() and NotificationSession.registerApplication() subsequently.
Registration remains active until the MIDlet calls the NotificationSession.unregisterApplication() in an active session.
The unregisterApplication call is required only if the end-user selects the option to opt out of push notifications for the MIDlet. In such cases, if a notification is pushed to the MIDlet by the service, a response 204 (No Content) by Notification Server towards REST API is generated.
Last updated 9 October 2013
We appreciate your feedback.