Triggering a Live Activity from a Widget-Based App Intent

Hello everyone,

I have an app leveraging SwiftData, App Intents, Interactive Widgets, and a Control Center Widget. I recently added Live Activity support, and I’m using an App Intent to trigger the activity whenever the model changes.

When the App Intent is called from within the app, the Live Activity is created successfully and appears on both the Lock Screen and in the Dynamic Island. However, if the same App Intent is invoked from a widget, the model is updated as expected, but no Live Activity is started.

Here’s the relevant code snippet where I call the Live Activity:

`

            await LiveActivityManager.shared.newSessionActivity(session: session)

And here’s how my attribute is defined:

    struct ContentState: Codable, Hashable {
        var session: Session
    }
}

Is there any known limitation or workaround for triggering a Live Activity when the App Intent is initiated from a widget? Any guidance or best practices would be greatly appreciated.

Thank you!

David

When the App Intent is invoked from your Widget it is in a different process than when invoked from your app. You can't start a live activity from your Widget process without using an intent unless that intent launches your app (which will call it in the App's process, where you can start an LA).

You may be able to utilize APNs and start your LA remotely by telling your server there was a change which can in turn push that to your app and start an activity. If a remote server is not available, you will want your Intent to be called from your app instead.

Please feel free to also file and enhancement request and ask that we add support for starting Live Activities from places such as Widgets.

Triggering a Live Activity from a Widget-Based App Intent
 
 
Q