If you are looking for Jitsi Meet, the WebRTC compatible video conferencing product click here.

Notification service

The Notification Service provides a generic access and an easy way to manage notifications. There is 4 possibles actions:

  • Command: execute a command
  • Log message: log a message through the application log system
  • Popup message: show a popup message (through the systray service for example)
  • Sound: play a sound

These actions can be combined to create a notification.

Create a notification

To create a notification you have to create the actions associated to this notification. There is two methods to register an action:

  • registerNotificationForEvent
  • registerDefaultNotificationForEvent

To create the notification, you should use the second one. It’s used to register the default settings. Attention: if the notification is created with the first method and the user restores the defaults settings, you notification will be erased.

For more informations see the API of the service.

Example

// Get service from the BundleContext
ServiceReference serviceReference = bundleContext.getServiceReference(NotificationService.class.getName());
NotificationService notificationService = (NotificationService) bundleContext.getService(serviceReference);

if(notificationService != null)
{
    // Register a popup message for a Test notification
    notificationService.registerDefaultNotificationForEvent(
            "TestNotification",
            NotificationService.ACTION_POPUP_MESSAGE,
            null,
            null);

    // Register a sound action for a Test notification
    notificationService.registerDefaultNotificationForEvent(
            "TestNotification",
            NotificationService.ACTION_SOUND,
            SoundProperties.INCOMING_MESSAGE,
            null);
}

Fire a notification

To fire a notification you just have to call one of the two form of the fireNotification method.

Example

// Get service from the BundleContext
ServiceReference serviceReference = bundleContext.getServiceReference(NotificationService.class.getName());
NotificationService notificationService = (NotificationService) bundleContext.getService(serviceReference);

if (notificationService != null)
{
    notificationService.fireNotification("TestNotification", "Title", "Message");
}