10.5 C
Canberra
Wednesday, October 29, 2025

Reside Exercise updates log “success” however Lock Display/Dynamic Island hold displaying defaults (Flutter live_activities 2.4.2)


the Reside Exercise begins and renders on the Lock Display/Dynamic Island, and Flutter logs report that updateActivity(…) calls succeed with the complete payload. Nevertheless, the widget UI by no means displays these updates—it solely reveals the default values outlined in Swift.

Reside Exercise updates log “success” however Lock Display/Dynamic Island hold displaying defaults (Flutter live_activities 2.4.2)


Surroundings

  • Flutter: steady (iOS, bodily system)

  • Plugin: live_activities: ^2.4.2

  • System iOS: 26.0.1

  • Runner (app) min iOS: 13

  • Extension min iOS: 18.2 (Reside Actions supported; additionally annotated with @obtainable(iOSApplicationExtension 16.1, *))

  • Xcode: 26.0.1

  • Entitlements:

    • App and Extension: Reside Actions + App Teams
    • App Group: group.com.instance.app (redacted)
  • Embedding: Extension embedded by way of Construct Phases → Embed Basis Extensions → Vacation spot: Plugins and Basis Extensions

  • Runner Goal Dependencies contains the extension; Skip Set up = Sure on extension


Symptom

  • createActivity(...) returns an ID and Reside Exercise renders.
  • Repeated updateActivity(...) calls log “up to date efficiently” with full state.
  • UI stays on Swift defaults (by no means displays Flutter-sent values).

Minimal Repro (Dart)

await reside.init(appGroupId: 'group.com.instance.app', urlScheme: 'vns');

closing id = await reside.createActivity(
  'LiveActivitiesAppAttributes', // additionally tried '<EXTENSION_TARGET_NAME>.LiveActivitiesAppAttributes'
  {
    'identify': 'Stress Session',
    'state': 'lively',
    'endTime': '16:33',
    'statusMessage': 'Session began',
    'depth': 1,
    'isPaused': false,
  },
);

await reside.updateActivity(id, {
  'identify': 'Stress Session',
  'state': 'lively',
  'endTime': '16:33',
  'statusMessage': 'Depth stage 2',
  'depth': 2,
  'isPaused': false,
});

Widget (Swift, simplified)

I attempted each paths: studying immediately from context.state.* and studying from App Group UserDefaults utilizing a prefixed key. Neither path displays Flutter updates; the UI stays on defaults.

import ActivityKit
import WidgetKit
import SwiftUI
import AppIntents

personal func appGroupId() -> String { "group.com.instance.app" }
let sharedDefaults = UserDefaults(suiteName: appGroupId())!

struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
  public typealias LiveDeliveryData = ContentState
  public struct ContentState: Codable, Hashable {
    var identify: String?
    var emoji: String?
    var state: String?
    var endTime: String?
    var statusMessage: String?
    var depth: Int?
    var isPaused: Bool?
  }
  var id = UUID()
}

@obtainable(iOSApplicationExtension 16.1, *)
struct SessionLiveActivity: Widget {
  var physique: some WidgetConfiguration {
    ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in
      // Path A: direct ContentState (tried this)
      // let sessionName = context.state.identify ?? "Default"

      // Path B: App Group defaults (tried this as a sanity take a look at)
      let sessionName = sharedDefaults.string(forKey: context.attributes.prefixedKey("identify")) ?? 

      let endTime = sharedDefaults.string(forKey: context.attributes.prefixedKey("endTime")) ?? "00:00"
      let statusMsg = sharedDefaults.string(forKey: context.attributes.prefixedKey("statusMessage")) ?? "lively"
      let depth = sharedDefaults.integer(forKey: context.attributes.prefixedKey("depth"))
      let isPaused = sharedDefaults.bool(forKey: context.attributes.prefixedKey("isPaused"))

      VStack {
        Textual content(sessionName)
        Textual content(endTime)
        Textual content(statusMsg)
        Textual content("(depth)")
        Textual content(isPaused ? "paused" : "lively")
      }
    }
  }
}

extension LiveActivitiesAppAttributes {
  func prefixedKey(_ key: String) -> String { "(id)_(key)" }
}

Logs (trimmed)

[log] Reside Actions service initialized efficiently
[log] Creating new Reside Exercise: {identify: Stress Session, emoji: ⚡, state: lively, endTime: 16:33, statusMessage: Session began, depth: 1, isPaused: false}
[log] Reside Exercise created efficiently with ID: 148D781F-E307-446B-AEC4-DA2D80A9B012
[log] Sending Reside Exercise replace with full state: {identify: Stress Session, emoji: ⚡, state: lively, endTime: 16:33, statusMessage: Depth stage 1, depth: 1, isPaused: false}
[log] Reside Exercise up to date efficiently
[log] Sending Reside Exercise replace with full state: {... depth: 2, ...}
[log] Reside Exercise up to date efficiently

What I’ve already tried

  • ✅ Runner → Goal Dependencies contains extension
  • ✅ Extension Skip Set up = Sure
  • ✅ Entitlements on each targets: Reside Actions, App Teams (group.com.instance.app)
  • ✅ Construct as soon as in Xcode; bodily system
  • ✅ Tried passing module-qualified kind: '<EXTENSION_TARGET_NAME>.LiveActivitiesAppAttributes'
  • ✅ Renamed statesessionState in each keys and Swift struct (to dodge any reserved-name quirks)
  • ✅ iOS 17-only Button(intent:) controls are availability-gated (not related to this decode subject)
  • ✅ Additionally examined studying state by way of UserDefaults (App Group) with prefixed key—UI nonetheless reveals defaults

Redaction

  • Bundle IDs, group IDs, and product names are changed with placeholders like group.com.instance.app and <EXTENSION_TARGET_NAME>.

Any thought how can I resolve this?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles