Please login to access all of the features of the Community Site.

UpdateLiveActivity

Mobile20.0  iOS16.1

Changes the content of a Live Activity that's already running, such as moving its progress bar or updating a room number. If no activity is running under the ActivityKey, it does nothing. That makes it safe for a page that refreshes on a timer: unlike StartLiveActivity, it won't bring back an activity the person has already dismissed.

The CommandParameter must be a LiveActivityParameters object with both ActivityKey and Title set. It replaces the activity's content, so include every property you still want shown, not only the ones that changed.

Warning

Your app must be built with Live Activities turned on. This is a build option, and the widget it adds needs its own provisioning profile. An app built without it ignores this command.

Note

Updates only come from the app. There's no server push, so an activity can't change while the app isn't running.

Properties

PropertyTypeDescription
ActivityKeystringThe key the activity was started with. Required.
TemplateIdstringThe template that shows the activity. Only generic is available. Defaults to generic.
TitlestringThe main line of text. Required.
SubtitlestringThe second line of text.
IconNamestringA Rock icon class for the icon the activity leads with, such as fa fa-check-circle or ti ti-clock. An icon that can't be shown falls back to the template's default.
AccentColorColorThe brand color for the Lock Screen card, the icon, the progress bar and the Dynamic Island outline. Takes a hex value or {Rock:PaletteColor ...}. Transparency is ignored.
IconColorColorThe color of the icon alone. Takes priority over AccentColor for the icon.
ProgressdoubleA value from 0 to 1, shown as a progress bar.
DetailLabelstringThe caption for the detail row, such as Security Code, Room or Seat. Ignored unless DetailValue is also set.
DetailValuestringOne value shown under the title on the Lock Screen and in the expanded Dynamic Island. Never shown in the compact Dynamic Island.
IsDetailSensitiveboolHides DetailValue while the device is locked and removes it once the activity is out of date. Defaults to true.
CompactLabelstringA few characters shown beside the icon in the compact Dynamic Island only. Longer text is cut off.
TargetDateTimeDateTimeThe end of a countdown. When set, the activity shows a timer instead of a progress bar.
MinutesFromNowdoubleThe end of a countdown, in minutes from now. Ignored when TargetDateTime is set.
StaleDateTimeDateTimeWhen the content stops being accurate. After this time the card dims and sensitive details are removed. Needs iOS 16.2 or later.
StaleMinutesFromNowdoubleWhen the content stops being accurate, in minutes from now. Ignored when StaleDateTime is set.

Examples

<Button Text="Update Progress"
    Command="{Binding UpdateLiveActivity}">
    <Button.CommandParameter>
        <Rock:LiveActivityParameters ActivityKey="checkin"
            Title="Checked In"
            Subtitle="Room 204"
            IconName="fa fa-user-check"
            Progress="0.75" />
    </Button.CommandParameter>
</Button>