Live Activities

Modern platform Mid-level Swift 5.9+ iOS 17+ Reviewed By Alok Singh

Order the steps

Order the steps to run a server-driven Live Activity.

  • End the activity with a final state and dismissal policy
  • Define ActivityAttributes with a ContentState
  • Start it with Activity.request(…, pushType: .token)
  • Send the activity's push token to your server
  • The server sends liveactivity pushes with new content state
Hint 1 of 1

Define it, start it, then update it.

Choose an answer, then open Show answer below to check it.

Show answer

Answer: B C D E A

  1. Define ActivityAttributes with a ContentState This describes fixed and changing data.
  2. Start it with Activity.request(…, pushType: .token) Asking for a push token enables remote updates.
  3. Send the activity's push token to your server The server addresses updates with it.
  4. The server sends liveactivity pushes with new content state APNs delivers updates to the activity.
  5. End the activity with a final state and dismissal policy Finished activities shouldn't linger.

30-second answer

A Live Activity shows live status on the Lock Screen and Dynamic Island. Define ActivityAttributes with a ContentState, start it with Activity.request(attributes:content:pushType: .token), and send its push token to your server. The server updates it with APNs pushes of type liveactivity carrying the new content state, and ends it with a dismissal policy. Updates are limited, so send only meaningful changes.

Practise saying it · 45 s. No recording, just a timer

Explain Live Activities.

Say your answer out loud, then check which of these points you covered:

  • Attributes and state
  • Push token flow
  • Update limits
  • Ending

Deep dive

An activity can be active for up to 8 hours; after it ends it can stay on the Lock Screen for up to 4 more, so 12 hours at most. Set a shorter dismissal policy, such as 15–30 minutes.

iOS 17.2 adds push-to-start tokens.

Static attributes and ContentState together, including data sent in push updates, can't exceed 4 KB.

Use relevance scores and alert configurations sparingly.

Common mistakes

  • Updating every second through push.
  • Forgetting to end the activity.

Senior take & follow-ups

Seniors cover the token flow, update budgets and ending.

Follow-up questions

Think of your answer first, then open the hint.

  1. What push type do updates use?

    Show hint

    apns-push-type: liveactivity with the activity's topic suffix.

  2. How do you start one remotely?

    Show hint

    A push-to-start token (iOS 17.2).

From the author

Push Notification Tester

Made by the author: send real APNs pushes to your own device to try the push questions on this page for yourself.

Suggest a fix if something here is wrong or out of date.