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.

Posts under ActivityKit tag

114 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

DeviceTokenNotForTopic
Some users couldn't receive push notifications, and APNS returned a 'DeviceTokenNotForTopic' error. Upon validation using Apple's tool, I found that some tokens are identified as VoIP push tokens, and some as Live Activity (LA) push tokens. When attempting to send a normal alert push using these VoIP/LA push tokens, it didn't work and returned a 'DeviceTokenNotForTopic' error. These tokens were obtained from Apple's delegate function 'didRegisterForRemoteNotificationsWithDeviceToken.' It's unexpected to receive VoIP/LA push tokens from this event, but this issue is occurring, and I've observed it specifically in iOS 17 users. This problem is not universal and is happening only for some users. Please take note that our app support VoIP Push, Live Activity Push and Normal Push notification. Could this be an iOS 17 bug? Any advice on this matter would be appreciated. Thanks.
3
0
2.7k
Sep ’24
How exactly do I get push tokens from a Live Activity that was started remotely?
In iOS 17.2+, we have a new feature that lets you use a push notification to start a Live Activity. The docs mention this: While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates. How exactly does this work? I don’t see any listeners/delegate methods that trigger when you receive a start event. Since I need to extract the push tokens from a specific instance, how do I get that instance? I can call Activity<MyType>.activities to see all running Live Activities, but assuming my end user has multiple instances running, how do I locate the instance that was started remotely?
2
0
939
Dec ’23
iOS 17 Live activity animations
I've been trying to implement an animation for my live activity. The animation is just rotating an image back and forth a bit and offsetting it up and down a bit. It'll give an airplane icon a subtle effect of "flying". Similar to the waveform animation in Apple Music, ie it's there for a it of visual flair. The documentation here states that withAnimation is ignored so I'm not entirely sure how these "constantly animating" effects are achieved. It seems like animations can only occur as transitions between states but it seems like overkill for my use-case of just wanting to animate a tiny bit of UI. Any advice would be greatly appreciated
0
0
657
Dec ’23
APNS returns 200 - Device did not receive Live Activities update
Hello! Currently we are reviewing an issue whereby our users were obtaining Live Activities update, but somehow at the end, there were Live Activity updates that were not properly received by the device. For example: 20 Live Activity updates sent to device, 17 were properly received, however the last 3 were not properly received (as can be seen by the UI of it not updating). So far we have looked into a few root causes highlighted on the forums and on stackoverflow: Timestamp of APNS (every one of the APNS has a different timestamp) 200 is seen from the APNS side, which is why we were confused by the push notification did not arrive on the device side Looking into our logs, its unfortunately not covered enough to tell us when this had been received Some questions here: Is there a way we could log every Live Activity / Push Notification received from APNS? (for all scenario, app on lock screen, app in background) Anyway to track a push notification's lifecycle? I know the Push Notification Console tool is useful for debug usage, but we wanted to see if there's something similar for production usage as well.
0
0
615
Dec ’23
Issue starting Live Activities with ActivityKit push notifications
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
12
5
5.6k
Aug ’24
Live Activity Push updates throttling with frequent updates
We are updating a Live Activity via push notifications quite frequently. As the documentation suggests, we are using NSSupportsLiveActivitiesFrequentUpdates for this case. We are sending all updates with apns-priority: 10. Is it still possible that iOS throttles push-updates with this setting enabled? For example we sent updates to APNS in this frequence: 2023-06-09T09:21:22.492224Z 2023-06-09T09:22:03.415876Z 2023-06-09T09:22:05.643268Z 2023-06-09T09:22:08.567353Z 2023-06-09T09:22:11.988442Z 2023-06-09T09:22:17.983494Z 2023-06-09T09:22:28.400757Z 2023-06-09T09:22:44.185622Z 2023-06-09T09:23:06.633058Z 2023-06-09T09:23:23.560052Z 2023-06-09T09:23:31.863625Z 2023-06-09T09:23:37.18351Z 2023-06-09T09:23:44.086319Z 2023-06-09T09:23:49.40655Z 2023-06-09T09:24:08.034848Z 2023-06-09T09:24:18.614194Z 2023-06-09T09:24:20.176428Z 2023-06-09T09:24:25.384654Z 2023-06-09T09:25:03.103147Z 2023-06-09T09:25:15.433726Z 2023-06-09T09:25:21.171693Z 2023-06-09T09:25:23.262028Z 2023-06-09T09:25:28.241116Z 2023-06-09T09:25:30.19816Z 2023-06-09T09:25:32.440543Z 2023-06-09T09:25:42.381815Z 2023-06-09T09:25:50.581656Z 2023-06-09T09:25:55.659846Z 2023-06-09T09:26:15.042667Z 2023-06-09T09:26:26.924626Z 2023-06-09T09:26:28.608762Z 2023-06-09T09:26:32.012874Z 2023-06-09T09:26:39.111211Z 2023-06-09T09:26:40.415326Z 2023-06-09T09:26:51.142985Z 2023-06-09T09:26:54.364073Z 2023-06-09T09:27:04.225692Z 2023-06-09T09:27:30.80347Z 2023-06-09T09:27:33.560981Z 2023-06-09T09:27:42.334313Z 2023-06-09T09:27:43.834646Z All of those were sent successfully, but at some point the activity stopped updating. The activity continued for several hours after, but was never updated again. What I checked so far: From device logs we can see that there was no updated push-token The sent content-state is correct From these observations and considering the high-frequent updates, I suspect that there is still some throttling happening here. Can anyone elaborate on this? Thanks in advance.
2
0
1.6k
May ’24
Text view with .timer style expands too much in Live Activity
I'm implementing a Timer in my app and I want the countdown to show up as a Live Activity. It works, but I get a very weird expanding effect on the Text view. The screenshots below show the issue, I can't tell if it's a bug or if I'm doing something wrong. My goal is to shrink the live activity black area so that it's a smaller, more reasonable size. There's no reason for it to be as large as it is on the trailing side. The Live Activity code (very basic):   } dynamicIsland: { context in        } compactTrailing: { // Important bit is here            Text(Date(), style: .timer)        }    } Which renders like this, with a lot of space after the timer: Adding a background color shows the view is expanding: Text(Date(), style: .timer)     .background(.red) And if I replace the timer with a standard text view, then no issue: Text("Hello")        .background(.red) Getting out of live activities and showing a standard timer view, there is no expansion issue: struct TestView: View {     var body: some View {         Text(Date(), style: .timer)             .background(.red)     } } So... I'm stumped. Any advice is appreciated.
6
8
2.9k
Aug ’24
Live Activity Dark mode issue with `.activityBackgroundTint(_:)`
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? 🙏
10
6
3.9k
Mar ’24
When set live activity dismissalPolicy: .after(endTime), the dynamic island not working
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?
3
5
1.7k
Mar ’24