public class LiveActivityDescriptor
- Object
- 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.
Constructors
public LiveActivityDescriptor(String activityType) | Creates a live activity descriptor. |
Methods
Inherited methods
Constructor details
LiveActivityDescriptor
public LiveActivityDescriptor(String activityType)Creates a live activity descriptor.
Parameters
activityTypeString- an app-defined type tag (e.g.
delivery), delivered back as the source of action events from this activity
Method details
setContent
public LiveActivityDescriptor setContent(SurfaceNode root)Sets the primary presentation: the iOS lock screen / banner layout, the Android expanded
notification and the desktop pill content.
Parameters
rootSurfaceNode- the layout root node
Returns
this descriptor, for chaining
setCompactLeading
public LiveActivityDescriptor setCompactLeading(SurfaceNode node)Sets the Dynamic Island compact leading region (left of the camera cutout).
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setCompactTrailing
public LiveActivityDescriptor setCompactTrailing(SurfaceNode node)Sets the Dynamic Island compact trailing region (right of the camera cutout).
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setMinimal
public LiveActivityDescriptor setMinimal(SurfaceNode node)Sets the Dynamic Island minimal region, shown when multiple activities compete for the
island.
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setExpandedLeading
public LiveActivityDescriptor setExpandedLeading(SurfaceNode node)Sets the leading region of the expanded (long-pressed) Dynamic Island.
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setExpandedTrailing
public LiveActivityDescriptor setExpandedTrailing(SurfaceNode node)Sets the trailing region of the expanded (long-pressed) Dynamic Island.
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setExpandedCenter
public LiveActivityDescriptor setExpandedCenter(SurfaceNode node)Sets the center region of the expanded (long-pressed) Dynamic Island.
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setExpandedBottom
public LiveActivityDescriptor setExpandedBottom(SurfaceNode node)Sets the bottom region of the expanded (long-pressed) Dynamic Island.
Parameters
nodeSurfaceNode- the region content
Returns
this descriptor, for chaining
setTint
public LiveActivityDescriptor setTint(SurfaceColor tint)Sets the accent color of the activity’s chrome (island key line, notification accent).
Parameters
tintSurfaceColor- the accent color
Returns
this descriptor, for chaining
setAndroidChannelId
public LiveActivityDescriptor setAndroidChannelId(String channelId)Sets the Android notification channel the activity’s ongoing notification posts to. When
unset a default
cn1_live_activities channel is used.Parameters
channelIdString- the channel id
Returns
this descriptor, for chaining
getActivityType
public String getActivityType()Returns the app-defined activity type tag.
getContent
public SurfaceNode getContent()Returns the primary presentation layout, or null.
getCompactLeading
public SurfaceNode getCompactLeading()Returns the compact leading island region, or null.
getCompactTrailing
public SurfaceNode getCompactTrailing()Returns the compact trailing island region, or null.
getMinimal
public SurfaceNode getMinimal()Returns the minimal island region, or null.
getExpandedLeading
public SurfaceNode getExpandedLeading()Returns the expanded leading island region, or null.
getExpandedTrailing
public SurfaceNode getExpandedTrailing()Returns the expanded trailing island region, or null.
getExpandedCenter
public SurfaceNode getExpandedCenter()Returns the expanded center island region, or null.
getExpandedBottom
public SurfaceNode getExpandedBottom()Returns the expanded bottom island region, or null.
getTint
public SurfaceColor getTint()Returns the accent color, or null.
getAndroidChannelId
public String getAndroidChannelId()Returns the Android notification channel id, or null for the default channel.