Hi everyone,
I have two questions regarding some issues with the new iOS 17 interactive widgets and live activities.
Question 1: How can I update other Widgets and/or Live Activities, based on an AppIntent interaction in either one?
I have several widgets that is displaying the same information, but in different sizes (Small, Medium, Large and Lockscreen). Most of our users are using many of them together on their Lockscreen and Home Screen. When they are interacting with the AppIntent button in either the Widget og LiveActivity it does not update and vice-versa.
Based on the documentation it's pretty clear that interacting with a Widget it will update the timeline for that specific widget after the .perform() in the AppIntent is returned. Unfortunately, I also need to update the LiveActivity and the other TimeLines for the rest of the widgets. I have tried to use the WidgetCenter.shared.reloadAllTimelines() but it seems like it does not update the LiveActivity or the LockScreen widgets correctly.
Question 2: How can I update and reschedule the local notifications based on the interaction in the Widget and Live Activity?
The app sends a local notification whenever an activity starts or stops (e.g like a pomodoro timer with intervals). Let's assume the user have setup a 30 minute activity in the app, but now decides to pause the activity from either the widget or live activity. I then want to remove the scheduled local notification that was supposed to be fired in 30 minutes. I haven't been able to read from the documentation if this is possible, but would like to know if there is any way this can be performed.
Looking forward to hear if anyone have encountered the same challenges :)
ActivityKit
RSS for tagHelp people keep track of tasks and events that they care about with Live Activities on the Lock Screen, the Dynamic Island, and in StandBy.
Posts under ActivityKit tag
95 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello,
I noticed that the layout of compact Dynamic Island on iOS 17 is incorrect. The edge of the circle shape is unable to be aligned with the edge of Dynamic Island.
However, the layout in Xcode Preview is just perfect. And this is also the same layout on previous iOS 16:
If you try to workaround the issue by adding an offset to the view, it will be cropped by a misaligned circle.
I have a food delivery app similar to Uber Eat it was developed in Objective C now the requirement is to implement the Live activity for tracking the Active orders in live Activity. As i tried Live activity over the Swift it is working fine on all IOS Devices but when i implement that swift code into Objective C using all the standards by Bridging between Swift and Obj C copied the same code, There is no Error or Warning i am seeing in Live activity functionality in Objective C, but Live Activity UI can't seen on Lockscreen even i have checked in settings my app is showing that it supports Live Activity but no view.
Can somebody help me out in that how to integrate live activity into Objective C project?
I have a history objective-c project, and now i want to use Live Acitivity feature in that objc project.
first i implement a live activity in swift project, and it works well on iphone devices.
then i copy same codes from swift project to objective-c project, build and run on same iphone device, no error or warning generates, but Live Activity UI can't seen.
can someone tell me how to fix it ? and only swift project can support Live Activity ?
Hey all, I was testing my app on my iPhone that just updated to 16.6. For some reason, when I request to show an Activity, the request goes through, tells me that my live activity is currently running (w/o any errors) yet won't show on the lock screen. When I tested on the Simulator, which is running 16.4, I am able to see the Live Activity perfectly fine. Has there been some change that would prevent me from seeing the Live Activity now?
I'm trying to build a live activity with the new iOS 17.0 interactivity, and I want a button on the live activity to update the live activity when clicked (e.g. start a timer).
This works fine with a widget, but with live activities it doesn't seem like the activity view gets refreshed instantly.
As a workaround, I tried putting the activity.update code in the button's intent's perform method. This doesn't seem to work as the intent gets executed from the widget extension, which seems to always have an empty activities (link) array.
Question: Is activity.update only meant to be called from the app (either foregrounded or in a background task), or should it also be possible to be called in the WidgetExtension itself?
Ideally I'd be able to avoid using push notifications, which seems overkill for e.g. just at timer.
Related thread: Changing the live activity without push notification
In a Live Activity, we have use case to show some countdown for the user o finish some tasks before a deadline. When the deadline reaches, we want to show a different message. We create a timer in our Live Activity codes, listen to it and want to change the text when the timer fires. But, the timer never fires. We write another simple codes to verify:
We didn’t see the countdown effect. We are wondering if
Timer is disabled in Live Activity, so it never fires
or
State variable is disabled, so even Timer fires and changes State variable’s value, View cannot pick up the new State variable’s value
Here you can see, we add Spacer in the bottom HStack, but the timer Text still expands and takes up all the horizontal space. There’s a discussion, but no one has the solution.
We notice when iPhone 14’s lock screen goes in Always-On mode, the countdown text in Live Activity:
seconds part is displayed as --
minutes part only refresh every minute.
Do you have any recommendations on how to improve it? For example, is there any system event or API to let our Live Activity know when lock screen enters/exit Always-On mode? If they are available, we would show something else to the user instead of xx:-- in Always-On lock screen.
There's an issue in the iOS 17 beta where passing nil to activityBackgroundTint(_:) does not use the system's default background material as expected. Instead, it's showing a solid black color instead of the correct tint that matches the rest of the system in iOS 16.
Is it possible to get enabled status of app's live activity through areActivitiesEnabled inside other targets (other than main target)? seems it always returns true.
If you update live activity with alertConfiguration: argument, iPhone shows a notification (or expands dynamic island):
await runningActivity.update(content, alertConfiguration: .init(title: "Alert", body: "Done!", sound: .default))
Paired Watch presents a notification as well:
I cannot find a way to dismiss that live activity notification from Watch. Is there a way to remove it similarly to UNUserNotifications?
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notificationID])
In iOS 17 beta 4, the Live Activity on lock screen is always rendered in dark mode. The issue can be reproduced both on physical device and simulator.
Hi,
i'm writing my first iOS Live Activity.
Two questions about that:
If "NSSupportsLiveActivitiesFrequentUpdates" is set, how many high-priority updates are permitted? I found no exact count.
If the Live Activity is ended by user in the Lock Screen (swiping left and remove), how can I catch this to stop server-side update requests?
Thanks!
I tried to implement interaction to live activity.Since we don't have force update like in widget, how to update the UI (like remove or add View) After performing the intent action.
Hello everyone,
I'm developing a new feature that allows the user to keep track of a background upload through live activities.
Im using the URLSessionTaskDelegate to keep track of the task progress and it works fine when the app is in foreground, but when the app goes to background, it stop after a few seconds. The upload still continues and Im able to receive updates on it's completion through the application(_ application: UIApplication, handleEventsForBackgroundURLSession but only through that.
Also when I put the app back to foreground it updates to the correct progress so this is only happening in background.
This is the URLSessionConfiguration I'm using:
let config = URLSessionConfiguration.background(withIdentifier: "\(uploadBackgroundTaskIdentifier)")
config.isDiscretionary = false
config.allowsCellularAccess = true
config.shouldUseExtendedBackgroundIdleMode = true
config.sessionSendsLaunchEvents = true
config.timeoutIntervalForResource = 28800
Does anyone knows how should I be able to keep track of the progress even when the app is in background?
According to apple
On devices that include an Always-On display, the system dims the
screen to preserve battery life and renders Live Activities on the
Lock Screen as if in Dark Mode. Use SwiftUI’s isLuminanceReduced
environment value to detect reduced luminance on devices with an
Always-On display and use images that look great for reduced
luminance.
But it seems to have no effect in live activities when displayed in the lock screen with AOD
@Environment(\.isLuminanceReduced) var isLuminanceReduced
Image("background1")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 400)
.offset(y:-40)
.brightness(isLuminanceReduced ? -0.5 : 0)
How do you animate in live activities?
I've seen apps been able to update around 1 fps. For example with a character looping a dance animation.
How is this done?
I don't think you can call Activity.update() every second. Also it wouldn't run in the background all the time anyway?
Here's an example of Apple's own WWDC video with a bar animating
https://imgur.com/a/yywW7a8
I wanted to show count down timer in live activity. Since we can't use Timer in extensions, I used Text.init(timerInterval:pauseTime:countsDown:showsHours:) to show timer. But I need to show different text when the timer ends. How to achieve this behaviour?
live Activity’s stale date is not getting updated from remote notification. If it’s just from app, it’s working however from remote notification nothing is happening? What could be the possible reason?