Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multtiple widget showing #79

Open
AMAL-KVS opened this issue Mar 25, 2024 · 2 comments
Open

multtiple widget showing #79

AMAL-KVS opened this issue Mar 25, 2024 · 2 comments

Comments

@AMAL-KVS
Copy link

there is anyone faced the same issue , am getting not every time , getting multtple widget showing
am using for charging progress

@Clon1998
Copy link
Contributor

I am encountering the same issue in my Flutter code. I keep track of all activities I start and verify if I need to create new ones whenever the app is brought to the foreground using the getAllActivities method. However, there are cases where the getAllActivities method returns an empty list even though I have multiple activities from my app running. I also implemented a new platform method, updateOrCreate, to handle whether a new live activity should be created on the iOS side based on a UUID I provide from my code to Swift, but this also fails/creates new activities indicating to me that activity it fails to report all active live activities.l

Maybe @istornz has another idea. Feel free to take a look at my platform code.

  @available(iOS 16.1, *)
  func createOrUpdateActivity(data: [String: Any], customId: String, removeWhenAppIsKilled: Bool, staleIn: Int?, result: @escaping FlutterResult) {
    Task {
      var customUUID = UUID(uuidString: customId)
      var activityId: String? = Activity<LiveActivitiesAppAttributes>.activities.first {
          $0.attributes.id == customUUID && $0.activityState != .dismissed && $0.activityState != .ended
      }?.id

      if activityId != nil {
        updateActivity(activityId: activityId!, data: data, alertConfig: nil, result: result)
      } else {
        createActivity(data: data, removeWhenAppIsKilled: removeWhenAppIsKilled, staleIn: staleIn, customId: customId, result: result)
      }
    }
  }

SRC

@Clon1998
Copy link
Contributor

@istornz do you happen to have any idea on what can be the reason for that issue and how to prevent it from happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants