InvergeDocs
.NETAPI reference

Live Activities

Live Activities in the .NET SDK.

SymbolKindSummary
LiveActivitiesResourceclassLive Activities — a live, updating view of something in progress.
LiveActivityBuilderclassComposes a Live Activity's data (or content state) and audience, then starts, updates or ends it.

LiveActivitiesResource

class
class Inverge.Nexus.Resources.LiveActivitiesResource

Live 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()

method
LiveActivityBuilder 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()

method
Task<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()

method
Task<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()

method
Task<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()

method
Task<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()

method
Task<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()

method
Task<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()

method
LiveActivityBuilder 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()

method
Task<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()

method
Task<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()

method
Task<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

class
class Inverge.Nexus.Builders.LiveActivityBuilder

Composes 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()

method
LiveActivityBuilder Alert(string title, string? body = null)

The iOS alert shown with the start. Start only.

Parameters

Prop

Type

Returns LiveActivityBuilder

Attributes()

method
LiveActivityBuilder 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()

method
LiveActivityBuilder Body(string value)

Sets the activity's body text.

Parameters

Prop

Type

Returns LiveActivityBuilder

Canceled()

method
LiveActivityBuilder Canceled()

Shows the canceled state.

Returns LiveActivityBuilder

Data()

method
LiveActivityBuilder Data(object data)

Merges raw template data (step, state, progress, etaAt, values).

Parameters

Prop

Type

Returns LiveActivityBuilder

DismissAt()

method
LiveActivityBuilder DismissAt(DateTimeOffset when)

When iOS should remove the ended activity. End only.

Parameters

Prop

Type

Returns LiveActivityBuilder

Done()

method
LiveActivityBuilder Done()

Shows the finished state.

Returns LiveActivityBuilder

EndAsync()

method
Task<LiveActivityResult> EndAsync(CancellationToken cancellationToken = default)

Ends the activity, with an optional final state.

Parameters

Prop

Type

Returns Task<LiveActivityResult>

Eta()

method
LiveActivityBuilder Eta(string text)

A fixed ETA text instead of a countdown, e.g. "8 min".

Parameters

Prop

Type

Returns LiveActivityBuilder

EtaAt()

method
LiveActivityBuilder EtaAt(DateTimeOffset at)

The arrival time — the device shows a live countdown with no further pushes.

Parameters

Prop

Type

Returns LiveActivityBuilder

EtaAt()

method
LiveActivityBuilder EtaAt(long unixTime)

The arrival time as unix seconds (milliseconds are detected and converted).

Parameters

Prop

Type

Returns LiveActivityBuilder

Lang()

method
LiveActivityBuilder Lang(string lang)

Forces one language for every recipient. Start only; default: each device's own.

Parameters

Prop

Type

Returns LiveActivityBuilder

Priority()

method
LiveActivityBuilder 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()

method
LiveActivityBuilder 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()

method
LiveActivityBuilder Set(string key, object? value)

Sets any content-state field.

Parameters

Prop

Type

Returns LiveActivityBuilder

Shared()

method
LiveActivityBuilder 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()

method
LiveActivityBuilder StaleAt(DateTimeOffset when)

Marks the activity stale after this time, so the UI can dim it.

Parameters

Prop

Type

Returns LiveActivityBuilder

StartAsync()

method
Task<LiveActivityResult> StartAsync(CancellationToken cancellationToken = default)

Starts the activity.

Parameters

Prop

Type

Returns Task<LiveActivityResult>

State()

method
LiveActivityBuilder State(object state)

Merges several content-state fields at once.

Parameters

Prop

Type

Returns LiveActivityBuilder

Status()

method
LiveActivityBuilder Status(string value)

Sets the activity's status line.

Parameters

Prop

Type

Returns LiveActivityBuilder

Step()

method
LiveActivityBuilder Step(string step)

The current step — a step id or label of the template.

Parameters

Prop

Type

Returns LiveActivityBuilder

Subtitle()

method
LiveActivityBuilder Subtitle(string value)

Sets the activity's subtitle.

Parameters

Prop

Type

Returns LiveActivityBuilder

Title()

method
LiveActivityBuilder Title(string value)

Sets the activity's title.

Parameters

Prop

Type

Returns LiveActivityBuilder

ToUser()

method
LiveActivityBuilder ToUser(string distinctId)

Targets one person. Start only.

Parameters

Prop

Type

Returns LiveActivityBuilder

ToUsers()

method
LiveActivityBuilder ToUsers(IEnumerable<string> distinctIds)

Targets specific people. Start only.

Parameters

Prop

Type

Returns LiveActivityBuilder

UpdateAsync()

method
Task<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()

method
LiveActivityBuilder Value(string key, object? value)

One value for the template's {{placeholder}}.

Parameters

Prop

Type

Returns LiveActivityBuilder

Values()

method
LiveActivityBuilder Values(object values)

Several placeholder values at once (an anonymous object or a dictionary).

Parameters

Prop

Type

Returns LiveActivityBuilder

On this page