Zum Inhalt springen

Countdown-Vorlage

Ein Timer mit servergesteuertem Lebenszyklus: Sende einen einzigen Start-Push, und der Server löst die Warn- und Abschluss-Updates selbst aus.

Demonstration einer Live-Aktivität

Fields

FieldTypeDescription
templatestringRequired. Must be "countdown"
progressfloatRequired. Initial progress (usually 0.0)
durationstringRequired (or end_date). Server-side convenience — converted to end_date before reaching the device. Accepts: "30s", "5m", "1h30m", or plain seconds ("1500")
end_dateintegerRequired (or duration). Unix timestamp when the countdown expires
start_dateintegerUnix timestamp when the countdown began. Must be less than end_date. Used to compute progress on-device.
warning_thresholdintegerSeconds before end_date to send a warning push (accent turns orange)
completion_messagestringText shown when countdown expires (default: "Completed")
statestringStatus text (e.g. "Baking", "Printing")
iconstringSF Symbol name or MDI icon with mdi: prefix (e.g. "mdi:timer-outline")
subtitlestringSecondary text
accent_colorstringNamed color or hex
background_colorstringBackground color override
text_colorstringText color override
alarmbooleanOpt-in: schedule an iOS AlarmKit alarm at end_date that rings through silent mode and Focus, with built-in Dismiss and Snooze. iOS 26+ only. Persists across partial updates until cleared with alarm: null or a transition to ended — see Alarms.
snooze_secondsintegerHow long the alarm's Snooze button defers the alarm, in seconds (60–3600). Defaults to 300 (5 minutes).
Kommt in App-Version 1.14.0

Accepts url_action, secondary_url_action, and tap_action — tap_action is useful for deep-linking back into the timer's source app while it runs. See Tap actions.

Example Payload

Einen Countdown starten
{
  "state": "ongoing",
  "content": {
    "template": "countdown",
    "progress": 0.0,
    "state": "Baking",
    "icon": "flame",
    "subtitle": "25 min timer",
    "duration": "25m",
    "warning_threshold": 60,
    "completion_message": "Done baking!",
    "accent_color": "orange",
    "alarm": true
  }
}

Auto-Managed Lifecycle

After the start push the server manages the remaining lifecycle, in this order; the timer display itself is computed on-device from start_date and end_date, so it counts down in real time without additional pushes.

PhaseTriggerWhat the server sends
StartYour pushNothing -- your update sets ended -> ongoing with the countdown content
Warningwarning_threshold seconds remainAn update with accent_color: "orange", automatically
Completionend_date reachedAn end push with completion_message and progress: 1.0