Using Notifications

The Dolby.io Communications APIs offer the notification service which allows application users to receive notifications related to conference events, even when users have not yet joined the conference.

The notification service consists of two parts: subscribing to notifications from the server and using event listeners. The subscription informs the server that the client wishes to receive the events. The event listeners allow developers to register callbacks and perform a specific programming action.

The notification service is responsible for notifying application users about the received conference invitations, created and ended conferences, and participants who joined or left conferences. The notification service is not responsible for any other notifications.

The subscription method takes an array of BaseSubscription objects:

subscribe(@NonNull subscriptions: List<BaseSubscription>): Promise

The BaseSubscription objects are implemented by the following subscription objects:

Note: By default, the subscription to invitations is enabled for all application users.

To unsubscribe from notifications, use the unsubscribe method, similarly to using the subscribe method.

To properly use notifications, follow this workflow:

1. Initialize the SDK and open a session. This step opens a WebSocket responsible for sending notification messages from the server to the client.

2. Call the subscribe method using the proper subscription type and the conference alias:

VoxeetSDK.notification().subscribe(subscriptions: SubscribeConferenceCreated, conferenceAlias: ExampleAlias)

After this step, the application sends the notification request to the server to register the client for the specific notifications. The application emits the ConferenceStatusNotificationEvent event to inform the users about the status of the subscribed conference.

3. Use an event listener to perform a specific action after receiving the notification:

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull ConferenceCreatedNotificationEvent event) {
    Log.d(TAG, "ConferenceCreatedNotificationEvent: event:=" + event.conferenceId + " " + event.conferenceAlias);
    System.out.println("conference " + event.conferenceAlias + " has been created")
}

After receiving the notification from the server, the application triggers the requested action.

To configure notifications options on Android, check the following models: