How do I begin development for Live Activities?
- Add a new† (widget) target to your app. Make sure you select ‘Live Activities’.
- Add the necessary plist items.
- Add push notification capability. Only needed if you want to start / update from server. If everything is done from within the app then you don’t need this. Example ‘Clock’ App on iPhone adds timers to your phone without any server interaction.
Note: A widget is a specific kind of app extension.
†: If you already have a widget then instead of adding a new target, just setup an
ActivityConfiguration
and then have it added to your Widget Bundle.
What’s the feature difference between a Live Activity and a Regular Push Notification?
Notifications have a fixed layout, with no ability to animate nor buttons to interact with.
Live Activities have custom UI and are far richer. Can be animated up to two seconds (or more see here). Can also have buttons added onto them. Live Activity is also positioned at where the dynamic island is at.
What’s the difference between Live Activity and Dynamic Island?
- Dynamic Island is a physical location of certain newer models. First introduced in iPhone 14 Pro, and then on every model since then.
- Live Activity is an Apple feature. Think of it as a shape shifting notification.
- The Live Activity appears in the dynamic island when the phone is unlocked. If a phone doesn’t have a live activity then it appears as a notification
What forms does the Live Activity take?
Apple calls the ‘presentations’. The Live Activity can appear in multiple presentations:
- Dynamic Island
- Compact
- Expanded
- Minimal (attached or detached)
- Lock Screen
For an in-app UI, see Does the Live Activity appear when app is in foreground? Apple requires you to have all presentations added. You can’t skip any of them.
How do I create an Expanded view?
The expanded view is made up of four sections.
You can share the leading / Trailing views between the expanded and compact. See here
Note:
- A Live Activity that’s started from a push Notification is immediately expanded upon its arrival. Then within a few seconds it shrinks down to a compact presentation.
- While a live activity that’s started from the app isn’t shown immediately at all. It’s starts showing in compact presentation after app is backgrounded.
Does the Live Activity appear when app is in foreground?
It does not.
- You need your own in-app UI. Figure out where / when you should show it.
- You can rely on the
ActivityUpdates
for changes in content and use that to update the in-app UI.
How do live activities and regular notifications stack against each other on lock screen?
Live activities sit on top of regular notifications.
How long can a Live Activity remain on the screen?
- Maximum of 8 hours on dynamic island
- Maximum of 12 hours on lock screen.
- or sooner if user dismisses it.
How can I remove a Live Activity from the screen?
Dismissing a live activity should not cancel the activity.
There are different ways to dismiss:
- From the compact presentation, you can swipe left on its center.
- From the expanded presentation, you can’t swipe left nor dismiss it.
- From the lock screen presentation, you can dismiss it like regular notifications.
So how can I cancel and remove an activity?
In the Apple Clock app, dismissing a Live Activity timer does NOT stop the timer. It just removes it from your dynamic island. Similarly, if you dismiss the live activity of an Uber trip, then it does NOT cancel the trip. Apple just removes the live activity from your dynamic island / screen.
If you needed to cancel an activity, then you can either add cancel buttons onto the live activity, and then allow users to cancel the timer using certain actions associated with the notification or allow users to tap on the live activity, open the app and then end it from within the app.
Cancelling should only be done upon an explicit action which should then dismiss the Live Activity for you as well.
Will the user get prompted to give access for tokens?
No. It’s provisional. As soon as you unlock, assuming the Live Activity is still on the screen, the user will get the choice of “Don’t Allow” , “Allow”