Class LiveActivityDescriptor
Describes a live activity: an ongoing-state surface (delivery, timer, ride, score) that stays
visible outside the app while it is in progress. The layout is built once from surface nodes
with ${key} placeholders; each LiveActivity.update(...) then ships only a fresh state map.
Platform lowering:
- iOS: ActivityKit live activity.
setContent(...)is the lock screen / banner presentation; theset...(...)region setters fill the Dynamic Island (ignored on devices without one). - Android: an ongoing notification whose collapsed and expanded views render
setCompactLeading/setCompactTrailingandsetContentrespectively. - Desktop: a floating always-on-top pill window rendering
setContent.
-
Constructor Summary
ConstructorsConstructorDescriptionLiveActivityDescriptor(String activityType) Creates a live activity descriptor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the app-defined activity type tag.Returns the Android notification channel id, or null for the default channel.Returns the compact leading island region, or null.Returns the compact trailing island region, or null.Returns the primary presentation layout, or null.Returns the expanded bottom island region, or null.Returns the expanded center island region, or null.Returns the expanded leading island region, or null.Returns the expanded trailing island region, or null.Returns the minimal island region, or null.getTint()Returns the accent color, or null.setAndroidChannelId(String channelId) Sets the Android notification channel the activity's ongoing notification posts to.setCompactLeading(SurfaceNode node) Sets the Dynamic Island compact leading region (left of the camera cutout).Sets the Dynamic Island compact trailing region (right of the camera cutout).setContent(SurfaceNode root) Sets the primary presentation: the iOS lock screen / banner layout, the Android expanded notification and the desktop pill content.setExpandedBottom(SurfaceNode node) Sets the bottom region of the expanded (long-pressed) Dynamic Island.setExpandedCenter(SurfaceNode node) Sets the center region of the expanded (long-pressed) Dynamic Island.Sets the leading region of the expanded (long-pressed) Dynamic Island.Sets the trailing region of the expanded (long-pressed) Dynamic Island.setMinimal(SurfaceNode node) Sets the Dynamic Island minimal region, shown when multiple activities compete for the island.setTint(SurfaceColor tint) Sets the accent color of the activity's chrome (island key line, notification accent).
-
Constructor Details
-
LiveActivityDescriptor
Creates a live activity descriptor.
Parameters
activityType: an app-defined type tag (e.g.delivery), delivered back as the source of action events from this activity
-
-
Method Details
-
setContent
Sets the primary presentation: the iOS lock screen / banner layout, the Android expanded notification and the desktop pill content.
Parameters
root: the layout root node
Returns
this descriptor, for chaining
-
setCompactLeading
Sets the Dynamic Island compact leading region (left of the camera cutout).
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setCompactTrailing
Sets the Dynamic Island compact trailing region (right of the camera cutout).
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setMinimal
Sets the Dynamic Island minimal region, shown when multiple activities compete for the island.
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setExpandedLeading
Sets the leading region of the expanded (long-pressed) Dynamic Island.
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setExpandedTrailing
Sets the trailing region of the expanded (long-pressed) Dynamic Island.
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setExpandedCenter
Sets the center region of the expanded (long-pressed) Dynamic Island.
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setExpandedBottom
Sets the bottom region of the expanded (long-pressed) Dynamic Island.
Parameters
node: the region content
Returns
this descriptor, for chaining
-
setTint
Sets the accent color of the activity's chrome (island key line, notification accent).
Parameters
tint: the accent color
Returns
this descriptor, for chaining
-
setAndroidChannelId
Sets the Android notification channel the activity's ongoing notification posts to. When unset a default
cn1_live_activitieschannel is used.Parameters
channelId: the channel id
Returns
this descriptor, for chaining
-
getActivityType
Returns the app-defined activity type tag. -
getContent
Returns the primary presentation layout, or null. -
getCompactLeading
Returns the compact leading island region, or null. -
getCompactTrailing
Returns the compact trailing island region, or null. -
getMinimal
Returns the minimal island region, or null. -
getExpandedLeading
Returns the expanded leading island region, or null. -
getExpandedTrailing
Returns the expanded trailing island region, or null. -
getExpandedCenter
Returns the expanded center island region, or null. -
getExpandedBottom
Returns the expanded bottom island region, or null. -
getTint
Returns the accent color, or null. -
getAndroidChannelId
Returns the Android notification channel id, or null for the default channel.
-