iosswiftuiwwdcwidgetliveactivity

is it possible to update live activity view after performing LiveactivityIntent action?


I need to update the live activity's view (like updating the text or remove and add buttons) after performing the intent action. For widget we have timeline mechanism to reload the UI. In apple document they mentioned that Liveactivity follows same life cycle as widget.

Live Activities don’t use a timeline mechanism to update their content. However, they use WidgetKit and a widget extension with a similar cycle of view archiving and decoding.

Not able to find a method to update live activities UI.


Solution

  • enter image description here

    Kindly refer the following git project https://github.com/praveeniroh/LiveActivity/tree/main/LiveActivity

    Note: we can update and end live activity without opening our app.

    Points to remember:

    1. The LiveActivityIntent file must be shared with both main target and widget target
    2. You have to provide specific UI while updating state