Ending Live Activities When Timer Expires

Hi everyone,

I'm working on an app that uses the Screen Time API, and I'm encountering an issue with Live Activities.

The app runs a timer (e.g., 10 minutes), after which the intervalDidEnd method in DeviceActivityMonitor is triggered. To improve the user experience, I've implemented Live Activities to display the remaining time.

However, I'm having trouble stopping the Live Activity when the timer expires and intervalDidEnd is called. It seems that the Screen Time extensions cannot detect or interact with active Live Activities, even though both share the same App Group.

My Question:

Since the DeviceActivityMonitor extension does not seem to be able to detect Live Activities, does anyone know if there’s a way to end a Live Activity when the timer expires without relying on a server? Using Apple’s Push Notification service feels excessive given the lightweight nature of the app, which doesn’t use server-side components.

Any insights or suggestions would be greatly appreciated!

Thanks!

staleDate will allow you mark the activity as out of date, which would mark it for removal without launching the app and manually ending it. That said, push notifications are the fastest way to provide on the fly updates, but staleDate should work if this date is known when you create the activity.

Rico WWDR - DTS - Software Engineer

Ending Live Activities When Timer Expires
 
 
Q