ActivityKit

RSS for tag

Help people keep track of tasks and events that they care about with Live Activities on the Lock Screen, the Dynamic Island, and in StandBy.

ActivityKit Documentation

Posts under ActivityKit tag

88 Posts
Sort by:
Post not yet marked as solved
1 Replies
110 Views
Is something wrong with testing live activities on Dynamic Island in iOS 17? It works fine for devices without dynamic island. It's a timer countdown. Initially, it didn't show up on the iPhone 15 Pro, but after installing and reinstalling the app it showed up. But now, the timer freezes like it was freezing while it was being tested on a simulator. Is there something extra I should be doing for the Dynamic Island Display? P/S: The app uses only Live Activities without the widget.
Posted
by Itunu.
Last updated
.
Post not yet marked as solved
5 Replies
389 Views
My background audio app stops updating its Live Activity after the iPhone locks, and doesn't resume updating the activity after tapping the screen or even after FaceID unlocks the device (without opening the lock screen). My live activity requests a ContentState update & iOS updates the content for the activity as below: Task{ log.debug("LiveActivityManager.updateLiveActivity() with new ContentState") await liveActivity.update( ActivityContent(state:contentState, staleDate:nil) ) } Below what my log looks like: <<<<SWIPE LOCK SCREEN DOWN>>>> DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4 DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4 <<<<PRESS LOCK BUTTON->Lock iPhone>>>> INFO: --------protectedDataWillBecomeUnavailableNotification-------- DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4 DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState <<<<LOOK AT & TAP LOCK SCREEN->Unlock iPhone without swiping up>>>> INFO: --------protectedDataDidBecomeAvailableNotification----------- DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState As shown in the log, normally iOS updates the content for my activity after my liveActivity.update request. This works fine in the Dynamic Island and when after switching apps and swiping down to see the lock screen without locking the phone. However, once I lock the phone, iOS stops updating the Live Activity content, and doesn't resume updates until after the app regains the foreground at least once. Has anyone else encountered this behavior? Is this a setting that I'm missing, or a bug?
Posted
by zabelc.
Last updated
.
Post not yet marked as solved
7 Replies
1.7k Views
Hi all, I'm trying to implement starting Live Activities with push notifications according to this article: https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications I'm using Xcode 15.1 beta 3, I have run my tests on a physical device with iOS 17.2 as well as the simulator with iOS 17.2 My problem is I can't seem to be able to get the pushToStartToken needed to start the live activities. I have subscribed to the pushToStartTokenUpdates but I never get any updates. Here is the code I used: Task { do { for try await data in Activity<DailyGoalActivityAttributes>.pushToStartTokenUpdates { let token = data.map {String(format: "%02x", $0)}.joined() print("Activity token: \(token)") } } catch { print(error) } } Any help would be greatly appreciated. Thanks, HS
Posted
by hs-dev.
Last updated
.
Post not yet marked as solved
0 Replies
113 Views
Hello all, I am trying to start Live Activity from remote push notification with the new ActivityKit api. The documentation for starting live activity from a push notification says: When the system receives the ActivityKit push notification on a device, it starts a new Live Activity, wakes up your app, and grants it background run time to allow you to download assets that the Live Activity needs. While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates. To update and end the Live Activity, use this update push token as if you obtained it by starting a Live Activity from within your app. Is there any information on how to get access to the background runtime and the push token, when the app is in background when the Live Activity is started? I can get the pushToStartTokenUpdates if the app is already running and push notification arrives (and starts the Live Activity), but not in the background, which makes getting updates not possible unless user launches the app. Thanks!
Posted
by lena.l.
Last updated
.
Post not yet marked as solved
1 Replies
167 Views
In iOS 17.2 we can start a live activity by push, and the document says: When the system receives the ActivityKit push notification on a device, it starts a new Live Activity, wakes up your app, and grants it background run time to allow you to download assets that the Live Activity needs. My problem is, in which callback can I be notified a live activity will be start by a push, so I can download some web contents such as images before the live activity be rendered.
Posted Last updated
.
Post not yet marked as solved
0 Replies
153 Views
When setting a systemActounForegroundColor, no effect is seen on the lock screen when swiping away a Live Activity. Attempted with custom color assets and system colors, but maybe I am using it incorrectly? @available(iOS 16.2, *) struct DevicePollingLiveActivityWidget: Widget { typealias constants = DevicePollingLiveActivityConstants var body: some WidgetConfiguration { ActivityConfiguration(for: AlarmPollingActivityAttributes.self) { context in DevicePollingLockScreenView(deviceEvent: context.state.device) .activityBackgroundTint(.clear) .activitySystemActionForegroundColor(.white) } dynamicIsland: { context in DynamicIsland { // Expanded UI goes here. Compose the expanded UI through // various regions, like leading/trailing/center/bottom DynamicIslandExpandedRegion(.leading) {```
Posted
by ckutz.
Last updated
.
Post not yet marked as solved
0 Replies
135 Views
In a live activity view, the update occurs upon pressing the button intent but does not automatically refresh after the application transitions to the background in SwiftUI.
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.2k Views
I have app that shows live activity and countdown till a date... VStack { Text("Countdown till You finish your homework")  Text(countdownTime, style: .timer) } After the time up, the live activity countup, the solution is to update the live activity via backgroundTask and this not always working, really apple sometimes fire the backgroundTask after hours. Another solution is to set dismissalPolicy: .after(countdownTime), but once I did that the dynamic island not working and the activity status is ended after right calling... await activity.end(using: state, dismissalPolicy: .after(countdownTime)) Can anyone help please, users feed back is why you we still see the old task on live activity. How come I can not update live activity? and how come if you set dismissalPolicy .after apple changes the activity status to ended and stop showing the dynamic island?
Posted
by iTarek.
Last updated
.
Post not yet marked as solved
11 Replies
2.3k Views
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.
Posted Last updated
.
Post not yet marked as solved
2 Replies
2.3k Views
Hello, i am implementing Live Activity and facing a problem setting custom color for widget background. I have a dedicated catalogue of colors for WidgetExtension each having light/dark variant. The problem is, however, that widget's view changes color variants (any/dark) according to system settings, but not system background & text of widget set via .activityBackgroundTint(_:) and activitySystemActionForegroundColor(_:) Both widget background and system button texts remain in light variant no matter what system setting was when starting Live Activity. Later, i was able to kinda force LA background color by checking color scheme in my widget view (yellow and brown for test purposes) .activityBackgroundTint(colorScheme == .light ? Color.surface. : Color.brown) this would force Live Activity background to have expected color from start. BUT when i later change appearance in system settings Live Activity behaves weirdly, as if it was caching previous color I provided. I installed 16.2 beta in hope that it was fixed, but noticed this behaviour 👇 system in light mode: LA start, LA background is light set system to dark: LA background light set system to light: LA background dark ❗️ set system to dark: do not pull notification center, do not look at LA, instead immediately 👇 set system to light: LA background light Is there any way around this? 🙏
Posted Last updated
.
Post not yet marked as solved
1 Replies
235 Views
We are interested to know what is the rate limit on the push notifications for live activities. We understand there is a "budget" on the amount of push notifications on a users device. But is there some rate limitation we should be aware of on APNs?
Posted Last updated
.
Post not yet marked as solved
0 Replies
212 Views
How can i pause and resume Text((context.state.startTime.convertStringToDate() ?? Date()), style: .relative) and ProgressView( timerInterval: progressStartDate...Date().addingTimeInterval(TimeInterval((Int(earnTime) ?? 0) * 60)), countsDown: false, label: { EmptyView() }, currentValueLabel: { EmptyView() } ) I couldn't find any document to pause and resume activity
Posted Last updated
.
Post not yet marked as solved
0 Replies
227 Views
When is there going to be access to the ScreenTime API / ActivityKit API so that we can programmatically access Phone Pickups and Screen Time for applications? Currently, the information is limited to getting callbacks when a threshold is hit or approached, but we don't know really anything about what the threshold is, and we cannot do that in the background. It seems incredibly limited on scope. Any thoughts or estimates on when this might be possible? Thank you so much!
Posted
by jlarkin.
Last updated
.
Post not yet marked as solved
0 Replies
225 Views
I'm using Text(targetDate, style:.relative) to show how a countdown of minutes until a given event. Unfortunately, this includes seconds, which takes unnecessary space and can get quite distracting when used on the dynamic island. There are many examples of apps that show estimates like "7 minutes" or "7 min" but how do they get the countdown to update? Are background updates reliable enough for this? Surely they don't send a push notification every minute to update the remaining time? Or is there some formatting option that I'm missing?
Posted
by mhalttu_.
Last updated
.
Post not yet marked as solved
2 Replies
333 Views
Environment: iOS Version: 17.2 iOS Simulator Version: 17.2 Xcode Version: 15.2 Device: iPhone 15 Pro Max App Target Version: iOS 17.2 Preconditions: App with Live Activity feature is installed. Device/Simulator is running iOS 17.2. Steps to Reproduce: Start the app and initiate a Live Activity with text styled as .timer. Lock the device screen or switch to the lock screen view in the iOS Simulator. Observe the Live Activity on the lock screen, noting the text style. Unlock the device. This time noting the .timer changed its style. The text style of the Live Activity remains consistent both on the lock screen and after unlocking the device, maintaining its .timer style throughout its lifecycle. Frequency: Occurs every time the steps are reproduced.
Posted
by Qwadrox.
Last updated
.
Post not yet marked as solved
0 Replies
209 Views
LiveActivity is effective in ios16, but error reported only in ios14 Some error message reported from Xcode: Process: LiveExtension [20099] Path: my.app/PlugIns/LiveExtension.appex/LiveExtension libswiftCore.dylib swift_getAssociatedTypeWitness SwiftUI BodyAccessor.makeBody(container:inputs:fields:) SwiftUl closure #1 in WidgetGraph.init(rootBundle:)
Posted
by zyh.
Last updated
.
Post not yet marked as solved
0 Replies
278 Views
All the documentation I've found so far is made for SwiftUI (I understand it was primarily designed for use with SwiftUI), but I'm still not able to find if there is even a way to do it. I tried to implement this very simple tutorial (https://www.youtube.com/watch?v=oloHJn1kj3w) and since it is done with SwiftUI, I tried to make a hybrid using UIHostingController, but had no luck. I made sure the configuration was set correctly, and I think it is because when I enter the app's settings (from the iPhone's settings app) the live activities button is there and turned on. Knowing how to do it would be awesome, but I would be satisfied with at least knowing if it is even possible, before wasting more time. Thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
354 Views
Can I have a play/pause button in a Live Activities notification for the user to play an audio file if he/she chooses to? Kind of like a Spotify-style/Apple-Music-style play/pause/skip/rewind functionality but in the long-lasting Live Activities notification. Thank you.
Posted Last updated
.
Post not yet marked as solved
0 Replies
299 Views
I read in official documents that there is a height range of 84-160. But when I preview, it is always fixed at a certain height. What should I do to make the height of DynamicIslandExpandedRegion grow dynamically according to the content?
Posted Last updated
.