Live Activities
Live Activities in the .NET SDK.
| Symbol | Kind | Summary |
|---|---|---|
LiveActivitiesResource | class | Live Activities — a live, updating view of something in progress. |
LiveActivityBuilder | class | Composes a Live Activity's data (or content state) and audience, then starts, updates or ends it. |
LiveActivitiesResource
classclass Inverge.Nexus.Resources.LiveActivitiesResourceLive Activities — a live, updating view of something in progress.
Templated (recommended): design the activity once in the Nexus console; the
mobile SDKs render it on iOS and Android in each device's language, and the
server sends only data — Template, StartTemplateAsync,
UpdateDataAsync, EndWithDataAsync.
iOS renders these on the Lock Screen and in the Dynamic Island; Android as an ongoing live notification. The server-side shape is always the same: start when the order or ride or match begins, update as it changes, end when it is done. iOS additionally needs the APNs key configured in the console — Live Activities cannot go through FCM — and a Widget Extension in the app.
Activity()
methodLiveActivityBuilder Activity(string activityTypeOrId, string? activityId = null)Starts a fluent activity. Pass the type and id to start one; pass just the id to update or end an existing one.
Parameters
Prop
Type
Returns LiveActivityBuilder
EndAsync()
methodTask<LiveActivityResult> EndAsync(string activityId, object? contentState = null, DateTimeOffset? dismissalDate = null, CancellationToken cancellationToken = default)Ends the activity, with an optional final state and dismissal time.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
EndWithDataAsync()
methodTask<LiveActivityResult> EndWithDataAsync(string activityId, object? data = null, DateTimeOffset? dismissalDate = null, CancellationToken cancellationToken = default)Ends a templated activity with its final data shown before dismissal —
e.g. new { step = "completed" } or new { state = "canceled" }.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
RegisterActivityAsync()
methodTask<NexusAck> RegisterActivityAsync(string activityId, string activityType, string platform = "ios", string? updateToken = null, object? contentState = null, NexusTelemetryContext? context = null, CancellationToken cancellationToken = default)Registers a running activity instance's update token.
Parameters
Prop
Type
Returns Task<NexusAck>
RegisterPushToStartTokenAsync()
methodTask<NexusAck> RegisterPushToStartTokenAsync(string activityType, string token, NexusTelemetryContext? context = null, CancellationToken cancellationToken = default)Registers an iOS push-to-start token. Normally the device SDK's job.
Parameters
Prop
Type
Returns Task<NexusAck>
StartAsync()
methodTask<LiveActivityResult> StartAsync(string activityType, string activityId, object? contentState = null, IEnumerable<string>? distinctIds = null, object? attributes = null, DateTimeOffset? staleDate = null, int? priority = null, CancellationToken cancellationToken = default)Starts an activity.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
StartTemplateAsync()
methodTask<LiveActivityResult> StartTemplateAsync(object template, string activityId, object? data = null, IEnumerable<string>? distinctIds = null, string? lang = null, string? alertTitle = null, string? alertBody = null, object? attributes = null, DateTimeOffset? staleDate = null, int? priority = null, CancellationToken cancellationToken = default)Starts a templated activity.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
Template()
methodLiveActivityBuilder Template(object template, string activityId)Starts a fluent templated activity. template is a template
key from the Nexus console (e.g. "order_tracking") or an inline design object.
Parameters
Prop
Type
Returns LiveActivityBuilder
TrackEventAsync()
methodTask<NexusAck> TrackEventAsync(string activityId, string type, string? platform = null, CancellationToken cancellationToken = default)Reports a delivery receipt, click or failure, for analytics.
Parameters
Prop
Type
Returns Task<NexusAck>
UpdateAsync()
methodTask<LiveActivityResult> UpdateAsync(string activityId, object? contentState = null, DateTimeOffset? staleDate = null, int? priority = null, CancellationToken cancellationToken = default)Pushes a new content state to every device showing the activity.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
UpdateDataAsync()
methodTask<LiveActivityResult> UpdateDataAsync(string activityId, object data, DateTimeOffset? staleDate = null, int? priority = null, CancellationToken cancellationToken = default)Updates a templated activity with partial data — only what changed. The server merges it into the activity's current data; a null inside clears a field.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
LiveActivityBuilder
classclass Inverge.Nexus.Builders.LiveActivityBuilderComposes a Live Activity's data (or content state) and audience, then starts, updates or ends it.
Template-only setters (Step, EtaAt,
Value, Canceled, …) send template data, which
the server merges on update. On their own, Progress and the texts
keep sending a plain contentState for your own widget.
Alert()
methodLiveActivityBuilder Alert(string title, string? body = null)The iOS alert shown with the start. Start only.
Parameters
Prop
Type
Returns LiveActivityBuilder
Attributes()
methodLiveActivityBuilder Attributes(object attributes)Sets fixed attributes, read once when the activity starts.
On iOS these are ActivityKit's static attributes: they cannot be changed by a later update, so anything that will change belongs in the content state.
Parameters
Prop
Type
Returns LiveActivityBuilder
Body()
methodLiveActivityBuilder Body(string value)Sets the activity's body text.
Parameters
Prop
Type
Returns LiveActivityBuilder
Canceled()
methodLiveActivityBuilder Canceled()Shows the canceled state.
Returns LiveActivityBuilder
Data()
methodLiveActivityBuilder Data(object data)Merges raw template data (step, state, progress, etaAt, values).
Parameters
Prop
Type
Returns LiveActivityBuilder
DismissAt()
methodLiveActivityBuilder DismissAt(DateTimeOffset when)When iOS should remove the ended activity. End only.
Parameters
Prop
Type
Returns LiveActivityBuilder
Done()
methodLiveActivityBuilder Done()Shows the finished state.
Returns LiveActivityBuilder
EndAsync()
methodTask<LiveActivityResult> EndAsync(CancellationToken cancellationToken = default)Ends the activity, with an optional final state.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
Eta()
methodLiveActivityBuilder Eta(string text)A fixed ETA text instead of a countdown, e.g. "8 min".
Parameters
Prop
Type
Returns LiveActivityBuilder
EtaAt()
methodLiveActivityBuilder EtaAt(DateTimeOffset at)The arrival time — the device shows a live countdown with no further pushes.
Parameters
Prop
Type
Returns LiveActivityBuilder
EtaAt()
methodLiveActivityBuilder EtaAt(long unixTime)The arrival time as unix seconds (milliseconds are detected and converted).
Parameters
Prop
Type
Returns LiveActivityBuilder
Lang()
methodLiveActivityBuilder Lang(string lang)Forces one language for every recipient. Start only; default: each device's own.
Parameters
Prop
Type
Returns LiveActivityBuilder
Priority()
methodLiveActivityBuilder Priority(int priority)Sets the APNs priority: 5 is routine and unmetered, 10 is immediate and metered against your Live Activity budget.
Parameters
Prop
Type
Returns LiveActivityBuilder
Progress()
methodLiveActivityBuilder Progress(double value)Sets progress, 0.0–1.0 (or 0–100). Templated: toward the next step or along the bar.
Parameters
Prop
Type
Returns LiveActivityBuilder
Set()
methodLiveActivityBuilder Set(string key, object? value)Sets any content-state field.
Parameters
Prop
Type
Returns LiveActivityBuilder
Shared()
methodLiveActivityBuilder Shared()Makes this a shared activity that many people watch — a match, a launch, an incident — rather than one person's order.
Returns LiveActivityBuilder
StaleAt()
methodLiveActivityBuilder StaleAt(DateTimeOffset when)Marks the activity stale after this time, so the UI can dim it.
Parameters
Prop
Type
Returns LiveActivityBuilder
StartAsync()
methodTask<LiveActivityResult> StartAsync(CancellationToken cancellationToken = default)Starts the activity.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
State()
methodLiveActivityBuilder State(object state)Merges several content-state fields at once.
Parameters
Prop
Type
Returns LiveActivityBuilder
Status()
methodLiveActivityBuilder Status(string value)Sets the activity's status line.
Parameters
Prop
Type
Returns LiveActivityBuilder
Step()
methodLiveActivityBuilder Step(string step)The current step — a step id or label of the template.
Parameters
Prop
Type
Returns LiveActivityBuilder
Subtitle()
methodLiveActivityBuilder Subtitle(string value)Sets the activity's subtitle.
Parameters
Prop
Type
Returns LiveActivityBuilder
Title()
methodLiveActivityBuilder Title(string value)Sets the activity's title.
Parameters
Prop
Type
Returns LiveActivityBuilder
ToUser()
methodLiveActivityBuilder ToUser(string distinctId)Targets one person. Start only.
Parameters
Prop
Type
Returns LiveActivityBuilder
ToUsers()
methodLiveActivityBuilder ToUsers(IEnumerable<string> distinctIds)Targets specific people. Start only.
Parameters
Prop
Type
Returns LiveActivityBuilder
UpdateAsync()
methodTask<LiveActivityResult> UpdateAsync(CancellationToken cancellationToken = default)Pushes the change to every device showing the activity — templated: partial data, merged server-side; plain: the new content state.
Parameters
Prop
Type
Returns Task<LiveActivityResult>
Value()
methodLiveActivityBuilder Value(string key, object? value)One value for the template's {{placeholder}}.
Parameters
Prop
Type
Returns LiveActivityBuilder
Values()
methodLiveActivityBuilder Values(object values)Several placeholder values at once (an anonymous object or a dictionary).
Parameters
Prop
Type
Returns LiveActivityBuilder
