Open AMAL-KVS opened 5 months ago
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)
}
}
}
there is anyone faced the same issue , am getting not every time , getting multtple widget showing am using for charging progress