enum · Swiftinterface · Kotlinunion type · TypeScriptabstract class · Dart
What Bubbl tells your app as it happens. Each step of a notification's life, geofences entered and left, errors, and a refused credential.
Events are for your app's own use, such as your analytics or your UI. Bubbl records its own. You receive them with Bubbl.addEventListener (and, on Flutter, the Bubbl.events stream), on the main thread. See Bubbl for adding and removing listeners, and Segments and events for how to use them.
!New events arrive in minor versionsA new event type is an addition, not a breaking change. Always give your when or switch an else or default branch that ignores events it doesn't know.
Every platform has the same thirteen events. Nine are about one notification and carry its BubblMessage. On iOS, "received" means when the app first sees the notification, not when it's delivered: see Platform differences.
interface BubblEvent, deliberately not sealed, so a when over it needs an else branch. Each event is a data class inside it, except CredentialRejected, which is a data object.
BubblEvent.NotificationReceived
(message: BubblMessage)
A notification arrived (from a geofence, a push or a pull), before it's shown.
BubblEvent.NotificationDisplayed
(message: BubblMessage)
The notification was shown.
BubblEvent.NotificationOpened
(message: BubblMessage)
Opened from its system notification.
BubblEvent.NotificationCtaClicked
(message: BubblMessage)
Its call to action was followed.
BubblEvent.NotificationDismissed
(message: BubblMessage)
It was closed without following its call to action.
BubblEvent.MediaViewed
(message: BubblMessage)
Its media was shown or started playing.
BubblEvent.MediaCompleted
(message: BubblMessage)
Its video or audio played to the end.
BubblEvent.SurveyStarted
(message: BubblMessage)
A survey was started.
BubblEvent.SurveySubmitted
(message: BubblMessage)
A survey's answers were sent.
BubblEvent.GeofenceEntered
(locationId: String)
The device entered one of the workspace's locations.
BubblEvent.GeofenceExited
(locationId: String)
The device left one of the workspace's locations.
BubblEvent.Error
(message: String)
Something went wrong that Bubbl couldn't fix itself. Also in diagnostics' lastError.
BubblEvent.CredentialRejected
data object
The server refused the credential Bubbl was started with (it was revoked, for example). Bubbl has stopped until it's started with a new one.
Listeners implement fun interface BubblEventListener { fun onEvent(event: BubblEvent) }.
public enum BubblEvent: Sendable, Hashable. Swift can't keep an enum open outside library evolution, so switch over it with a default: case.
.notificationReceived
(BubblMessage)
A notification arrived (from a geofence, a push or a pull), before it's shown.
.notificationDisplayed
(BubblMessage)
The notification was shown.
.notificationOpened
(BubblMessage)
Opened from its system notification.
.notificationCtaClicked
(BubblMessage)
Its call to action was followed.
.notificationDismissed
(BubblMessage)
It was closed without following its call to action.
.mediaViewed
(BubblMessage)
Its media was shown or started playing.
.mediaCompleted
(BubblMessage)
Its video or audio played to the end.
.surveyStarted
(BubblMessage)
A survey was started.
.surveySubmitted
(BubblMessage)
A survey's answers were sent.
.geofenceEntered
(locationId: String)
The device entered one of the workspace's locations.
.geofenceExited
(locationId: String)
The device left one of the workspace's locations.
.error
(message: String)
Something went wrong that Bubbl couldn't fix itself. Also in diagnostics' lastError.
.credentialRejected
no payload
The server refused the credential Bubbl was started with. Bubbl has stopped until it's started with a new one.
Listeners are closures, @MainActor @Sendable (BubblEvent) -> Void. addEventListener returns a BubblEventToken to remove the listener with.
abstract class BubblEvent, so a switch over it needs a default case. The nine notification events extend abstract class BubblNotificationEvent, which has the message field. Each event is a final class.
BubblNotificationReceived
BubblMessage message
A notification arrived (from a geofence, a push or a pull), before it's shown.
BubblNotificationDisplayed
BubblMessage message
The notification was shown (by Bubbl, or by the app and reported).
BubblNotificationOpened
BubblMessage message
Opened from its system notification.
BubblNotificationCtaClicked
BubblMessage message
Its call to action was followed.
BubblNotificationDismissed
BubblMessage message
It was closed without following its call to action.
BubblMediaViewed
BubblMessage message
Its media was viewed (a video or audio started, say).
BubblMediaCompleted
BubblMessage message
Its video or audio was played to the end.
BubblSurveyStarted
BubblMessage message
A survey was started.
BubblSurveySubmitted
BubblMessage message
A survey's answers were sent.
BubblGeofenceEntered
String locationId
The device entered one of the workspace's locations.
BubblGeofenceExited
String locationId
The device left one of the workspace's locations.
BubblError
String message
Something went wrong that Bubbl couldn't fix itself. Also in diagnostics' lastError.
BubblCredentialRejected
no fields
The server refused the credential Bubbl was started with. Bubbl has stopped until it's started with a new one.
BubblEvent.fromMap(Map<String, Object?> map) turns the object the native SDK sends into an event, or null for a type this version doesn't know. Bubbl.events leaves those out.
type BubblEvent, a union of plain objects told apart by type. Switch on event.type with a default branch.
'notification.received'
{ type; message: BubblMessage }
A notification arrived (from a geofence, a push or a pull), before it's shown.
'notification.displayed'
{ type; message: BubblMessage }
The notification was shown.
'notification.opened'
{ type; message: BubblMessage }
Opened from its system notification.
'notification.cta_clicked'
{ type; message: BubblMessage }
Its call to action was followed.
'notification.dismissed'
{ type; message: BubblMessage }
It was closed without following its call to action.
'media.viewed'
{ type; message: BubblMessage }
Its media was shown or started playing.
'media.completed'
{ type; message: BubblMessage }
Its video or audio played to the end.
'survey.started'
{ type; message: BubblMessage }
A survey was started.
'survey.submitted'
{ type; message: BubblMessage }
A survey's answers were sent.
'geofence.entered'
{ type; locationId: string }
The device entered one of the workspace's locations.
'geofence.exited'
{ type; locationId: string }
The device left one of the workspace's locations.
'error'
{ type; message: string }
Something went wrong that Bubbl couldn't fix itself. Here message is text, not a BubblMessage.
'credential.rejected'
{ type }
The server refused the credential Bubbl was started with. Bubbl has stopped until it's started with a new one.
Was this page helpful?
Thanks. The docs team reads every response.
esc
Try a different word, or ask the AI. It can explain things that don't have their own page.