When implementing Nokia Notifications in your MIDlet/Service, consider the following general requirements:
Your MIDlet shall ask the end-user whether he or she wants to receive Nokia Notifications for your application or not. You may do this, for example, by providing an application setting value for this with relevant information. You may also implement a dialog that is launched within the first launch of the application; the end-user is provided with a selection whether to take the Nokia Notifications into use or not.
A reference implementation logic for handling the end-user permission value — First launch of your MIDlet:
Show a query to the end-user to ask for his/her permission for subscription of the application specific Nokia Notifications. The text shown is up to your implementation; for example, the text could be something like this: "Do you want to receive service X related push notifications?"
If the end-user allows the Nokia Notifications then the MIDlet
shall call NotificationSessionFactory.NotificationSession.openSession
and NotificationSession.registerApplication
etc
as instructed elsewhere about the registration. The MIDlet should
store somehow the permission to be able to check it during later launches
to know if the Nokia Notifications are used or not. In addition the
permission value can be shown on the application specific settings
where the end-user can change the value.
Second or later launch of the application:
MIDlet should check from the application settings whether the end-user has allowed the application specific Nokia Notifications or not.
If the end-user has according to the stored setting value allowed the Nokia Notifications then your MIDlet should do the Nokia Notifications API related registration for Nokia Notifications subscription.
If your service sends only publish (broadcast) method kind of messages then you do not need to implement logic for handling the Notification ID (NID). In case your service needs to send notifications for one or more users but not all at once then your MIDlet needs to request NID and tell it to your service. Service uses then NID to address your notifications targeted for you (to the MIDlet running on your device). Remember that the NID is device+application specific value. This means that if your service requires user authentication then the NID value should be always switched over to point to the current user profile in your service.