pub struct ActivityContent {Show 33 fields
pub id: String,
pub title: String,
pub body: Option<String>,
pub progress: Option<f64>,
pub progress_segments: Option<Vec<ProgressSegment>>,
pub progress_points: Option<Vec<ProgressPoint>>,
pub ends_at: Option<u64>,
pub icon: Option<String>,
pub tint: Option<String>,
pub layout: Option<WidgetElement>,
pub compact_leading: Option<WidgetElement>,
pub compact_trailing: Option<WidgetElement>,
pub minimal: Option<WidgetElement>,
pub lock_screen: Option<WidgetElement>,
pub island_leading: Option<WidgetElement>,
pub island_trailing: Option<WidgetElement>,
pub island_center: Option<WidgetElement>,
pub keyline_tint: Option<String>,
pub background_tint: Option<String>,
pub sub_text: Option<String>,
pub short_critical_text: Option<String>,
pub started_at: Option<u64>,
pub visibility: Option<String>,
pub category: Option<String>,
pub actions: Vec<ActivityAction>,
pub url: Option<String>,
pub stale_at: Option<u64>,
pub push: bool,
pub template: Option<String>,
pub relevance_score: Option<f64>,
pub alert: Option<ActivityAlert>,
pub timestamp: Option<u64>,
pub data: Option<Value>,
}Expand description
Start or update request for a live activity.
Fields§
§id: StringYour key for this activity (letters, digits, ., _, -). Starting an id that is
already running updates it.
title: StringMain line (notification title on Android). Required unless a template gives it.
body: Option<String>Second line.
progress: Option<f64>Progress 0..=1.
progress_segments: Option<Vec<ProgressSegment>>Android 16 Live Updates ProgressStyle track: relative lengths and colors (one
tint segment when omitted). Other platforms draw a plain bar.
progress_points: Option<Vec<ProgressPoint>>Android 16 Live Updates ProgressStyle markers along the track.
ends_at: Option<u64>Unix ms the countdown runs to (live timer; Android status-bar chip countdown).
icon: Option<String>SF Symbol name (mapped to Material / emoji off Apple).
tint: Option<String>Accent color (hex) for the icon, progress and Android notification.
layout: Option<WidgetElement>Full layout (Lock Screen, expanded Dynamic Island, desktop window).
compact_leading: Option<WidgetElement>Dynamic Island compact, leading side.
compact_trailing: Option<WidgetElement>Dynamic Island compact, trailing side.
minimal: Option<WidgetElement>Dynamic Island minimal (several activities at once).
lock_screen: Option<WidgetElement>iOS Lock Screen layout when it should differ from layout (the expanded island).
island_leading: Option<WidgetElement>Expanded Dynamic Island, leading region.
island_trailing: Option<WidgetElement>Expanded Dynamic Island, trailing region.
island_center: Option<WidgetElement>Expanded Dynamic Island, center region (under the camera).
keyline_tint: Option<String>Dynamic Island keyline color (hex).
background_tint: Option<String>Lock Screen background color (hex) when the layout has none.
sub_text: Option<String>Android: small text after the app name (notification sub text).
short_critical_text: Option<String>Android 16: short text for the promoted status-bar chip (≤ 7 characters).
started_at: Option<u64>Unix ms the activity started: a stopwatch counts up from it (when endsAt is unset).
visibility: Option<String>Android lock-screen visibility: public (default), private, secret.
category: Option<String>Android notification category (progress default, navigation, transport,
workout, status, alarm, service, event).
actions: Vec<ActivityAction>Buttons (Android notification actions, at most 3). Taps arrive as widget-action
with widgetId = "activity.<id>".
url: Option<String>Deep link opened on tap.
stale_at: Option<u64>Unix ms after which the OS marks the content outdated (iOS staleDate).
push: booliOS: request an APNs push token (activity-token event, pushToken in the result).
template: Option<String>Name of a layout stored with registerActivityTemplate: the device fills it with
data ({{data.eta}}, when, repeat, …), so updates carry only data. Fields
set on this content override the template’s.
relevance_score: Option<f64>iOS: which of several activities the system shows first (higher wins).
alert: Option<ActivityAlert>iOS: alert shown with this update (lights the screen, plays sound).
timestamp: Option<u64>Unix ms the content was produced: an older update than the shown one is dropped.
data: Option<Value>Values for {{data.…}} in the template.
Implementations§
Source§impl ActivityContent
impl ActivityContent
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Reject what no platform can show: empty id or title, bad charset, too many actions,
progress out of range, payload over MAX_ACTIVITY_BYTES.
Sourcepub fn filled(self) -> Self
pub fn filled(self) -> Self
The request with layout filled by Self::effective_layout: what every surface
receives, so a native renderer never needs its own default.
Sourcepub fn effective_layout(&self) -> WidgetElement
pub fn effective_layout(&self) -> WidgetElement
layout, or one built from the plain fields: icon + title, body, timer, progress.
Trait Implementations§
Source§impl Clone for ActivityContent
impl Clone for ActivityContent
Source§impl Debug for ActivityContent
impl Debug for ActivityContent
Source§impl Default for ActivityContent
impl Default for ActivityContent
Source§impl<'de> Deserialize<'de> for ActivityContent
impl<'de> Deserialize<'de> for ActivityContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ActivityContent
Available on crate feature schema only.
impl JsonSchema for ActivityContent
schema only.Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more