Can Live Activities be updated via `activity.update` in extensions?

I'm trying to build a live activity with the new iOS 17.0 interactivity, and I want a button on the live activity to update the live activity when clicked (e.g. start a timer).

This works fine with a widget, but with live activities it doesn't seem like the activity view gets refreshed instantly.

As a workaround, I tried putting the activity.update code in the button's intent's perform method. This doesn't seem to work as the intent gets executed from the widget extension, which seems to always have an empty activities (link) array.

Question: Is activity.update only meant to be called from the app (either foregrounded or in a background task), or should it also be possible to be called in the WidgetExtension itself?

Ideally I'd be able to avoid using push notifications, which seems overkill for e.g. just at timer.


Related thread: Changing the live activity without push notification

Answered by freshdried in 761395022

Aha, so the issue was that I did not include the intent in the application bundle. Once I did that, the app now performs the update in the application (as opposed to the widget extension).

Reference: https://stackoverflow.com/questions/76566373/why-dont-interactive-buttons-in-ios-17-widget-call-appintent-perform-when-the

Perhaps this could be clarified in this bit of documentation: https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function

Ideally we could call activity.update from all extensions from the same app group (e.g. a network extension), but if it's just the widgetextension itself that's okay too.

I'm a little bit confused too as to why the intent handler (perform) is running in the Widget Extension and not the app, as it says here:

"When a person interacts with a button or toggle in your widget, the system runs the perform() function in your app’s process."
Accepted Answer

Aha, so the issue was that I did not include the intent in the application bundle. Once I did that, the app now performs the update in the application (as opposed to the widget extension).

Reference: https://stackoverflow.com/questions/76566373/why-dont-interactive-buttons-in-ios-17-widget-call-appintent-perform-when-the

Perhaps this could be clarified in this bit of documentation: https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function

Can Live Activities be updated via `activity.update` in extensions?
 
 
Q