Featured interfaces
- net.rim.device.api.notification.NotificationsEngineListener
This interface provides methods to manage UI notifications. If you want the notification to display any UI components when the notification occurs, you must define these UI events in the implementation of this interface. If you do not want to start any UI events, you do not need to implement this interface. For example, if you only want the event to cause the LED light of the BlackBerry® device to flash, you do not need to implement this interface.
This interface provides the following three methods that you can use to display a UI notification, depending on the state of the BlackBerry device:
- the deferredEventWasSuperseded() method is invoked when another event that has the same or greater level occurs after this event
- the notificationsEngineStateChanged() method is invoked when the state of the notifications engine has changed, for example, if the BlackBerry device has been removed from the holster
- the proceedWithDeferredEvent() method is invoked when the NotificationsEngineListener is free to proceed with the event
The sample application displays a dialog box with the message "Notification for event id: event_id" when proceedWithDeferredEvent() is invoked. Note that if this event is never superseded by another notification event, this method is invoked when the event starts. To handle the case that this event was superseded and is resuming, the sample application uses the boolean class variable _dialogShowing to determine if the dialog box has already been created and displayed. This variable prevents multiple dialog boxes from being created and displayed for the same event.
For the remaining two methods, the sample application just displays text alerting the user that the event has been superseded or the state of the notifications engine has changed for deferredEventWasSuperseded() and notificationsEngineStateChanged()respectively.
- net.rim.device.api.notification.Consequence
This interface provides methods to manage the starting and stopping of notification events. This interface provides the methods startNotification() and stopNotification() methods which specify the actions for the BlackBerry device to take when an event begins and ends. The methods startNotification() and stopNotification() methods use a Configuration object to perform context-specific functions. For example, the Configuration object might contain data that includes notification settings that the user has set on the BlackBerry device.
The sample application just provides a trivial Conifguration object that does not affect the startNotification() and stopNotification() methods.
- net.rim.device.api.synchronization.SyncObject
-
This interface implements the method getUID() which provides the unique ID of the synchronizable object in a SyncCollection.
In the sample application, no data is being synchronized so this method just returns 0.
- net.rim.device.api.synchronization.SyncConverter
-
This interface implements two convert() methods for converting a SyncObject to a serialized form and for converting a serialized form to a SyncObject. The serializable form is required before data can be sent over the wireless network.
The sample application converts the Configuration object to be sent by writing it to a DataBuffer with a header specifying its type and length. The sample application also converts an object that it received into a Configuration object.
Featured classes
- net.rim.device.api.notification.NotificationsManager
This class provides methods to manage the handling of events between applications and the notification engine, the registration of NotificationsEngineListener and Consequence interface implementations, and the registration of applications as sources of notification events.
In the registerNotificationObject() method of the NotificationDemo class, the sample application uses the NotificationManager class to register the sample application as a source of notification events, the NotificationEngineListenerImpl class as the NotificationEngineListener implementation of the NotificationDemo class, and the ConsequenceImpl class as the Consequence implementation of the NotificationDemo class.
The sample application also uses this class to start and stop notification events in the Event class' fire() and cancel() methods respectively.
- net.rim.device.api.system.Alert
This class provides methods to access the BlackBerry® device's audio features. You can use these methods to check which audio features are supported, to set the master volume or the volumes of each distinct audio type, and to start and stop the sound from each audio source.
The sample application uses this class to start the buzzer and music when a notification event starts and to stop the buzzer and music when a notification event stops.
- net.rim.device.api.system.LED
This class provides methods to access the BlackBerry device's LED light. You can use these methods to check which features of the LED light are supported and to set the state of the LED notification light with a specific configuration.
The sample application uses this class to set the LED notification light to on when a notification event starts and to set the LED notification light to off when a notification event stops.