Alerts

interface Alerts

This module provides methods for managing devices that receive alerts based on the Common Alerting Protocol (CAP).

The Alerts module allows applications to create, update, and manage devices (represented as AlertDevice objects) that are associated with a user account and configured to receive CAP-based emergency alerts. These alerts can be critical notifications such as weather warnings, disaster alerts, or public safety messages.

Additionally, the module supports sending acknowledgment responses to received alerts, allowing feedback to the alerting system.

The key functionalities provided by this module include:

  • Creating and updating AlertDevice objects.

  • Deleting devices that no longer need to receive alerts.

  • Sending acknowledgment and feedback responses for received alerts.

Based on this module, developers can ensure their applications are prepared to receive timely emergency notifications and provide feedback to the alerting system.

Samples

com.ale.rainbowsdk.samples.AlertsSample

Types

Link copied to clipboard

Listener interface for receiving real-time alert notifications.

Functions

Link copied to clipboard
abstract fun createDevice(device: AlertDevice, listener: RainbowListener<AlertDevice, Unit>)

Creates a new device associated with the user account. This device will be registered to receive alerts based on The Common Alerting Protocol (CAP).

Link copied to clipboard
abstract fun deleteDevice(deviceId: String, listener: RainbowListener<Unit, Unit>)

Deletes an AlertDevice, removing its ability to receive CAP-based alerts.

Link copied to clipboard
abstract fun fetchDevices(listener: RainbowListener<AlertDevicesData, Unit>)

Retrieves a list of devices that are registered to receive CAP-based alerts for the current user.

Link copied to clipboard

Registers a listener to receive real-time alert notifications.

Link copied to clipboard
abstract fun sendAlertFeedback(deviceId: String, alertId: String, answerId: String, listener: RainbowListener<Unit, Unit>)

Sends feedback in response to an alert.

Link copied to clipboard
abstract fun sendReadAcknowledge(alertTemplate: AlertTemplate)

Sends a "read acknowledgment" for a received alert.

Link copied to clipboard
abstract fun sendReceivedAcknowledge(alertTemplate: AlertTemplate)

Sends a "received acknowledgment" for a received alert.

Link copied to clipboard

Unregisters a previously registered alert notification listener.

Link copied to clipboard
abstract fun updateDevice(device: AlertDevice, listener: RainbowListener<AlertDevice, Unit>)

Updates an existing AlertDevice associated with the user’s account.