Go to the Nokia Developer Console sending tool at https://account.nnapi.ovi.com/cm/Web/services.jsp, type an identifier (com.mynotificationexample in this example) for the service in the Service ID field, and click on Create button.
The service credentials such as Service ID, Application ID, and Service secret are created and displayed on the screen.
Note: When creating a Service ID, take care of the following:
Allowed characters: a-z, 0–9, . (period) and - (hyphen)
Minimum length: 1 character
Maximum length: 255 characters
Restrictions: ID cannot start with a period or hyphen
Download and modify the NNAClientExample MIDlet with the generated service credentials (Service ID and Application ID).
Change the parameters for the NotificationSessionFactory.openSession
method to include the created Service ID (com.mynotificationexample
in this example) and the generated Application ID (mynotificationexample.com
in this example).
try { session = NotificationSessionFactory.openSession( main, // The MIDlet instance "com.mynotificationexample", // Service ID "mynotificationexample.com", // Application ID this); // NotificationSessionListener }
After modification, install the NNAClientExample MIDlet on the Emulator or device.
Download and install the EnvironmentSelector MIDlet (included with NNAClientExample MIDlet) on the Emulator or device.
Run the EnvironmentSelector MIDlet, select the Sandbox environment from the list. Tap on Save button, and then tap on Done button.
This will set the Notification Enabler to point to the Sandbox environment.
Run the NNAClientExample MIDlet, and tap on Register button.
The MIDlet tries to connect to the Notification Enabler, registers it, changes its notification status to Online, and enables it to receive notification messages.
Note: If the notification status does not change to Online, check and correct the network proxy server settings.
Tap on Get Notification ID button.
The MIDlet retrieves the Notification ID from the Nokia Notification Server, and displays it on the screen.
Note: The generated Notification ID can be copied from the Diagnostics window of the Emulator.
Go to the Nokia Developer Console sending tool at https://account.nnapi.ovi.com/cm/Web/services.jsp, and click on the created Service ID (com.mynotificationexample in this example) link from the list of services.
The console displays the Push Notification pane on the right of the list of services.Paste the Notification ID in the id field, type “Hello” in the payload field, and click on Push button.
The notification message is displayed on the screen.