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

95 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Live Activity Not working on Dynamic Island on TestFlight
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.
1
0
321
Apr ’24
Starting Live Activity with push notification
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!
2
0
425
Apr ’24
How to handle Push To Start Live Activity background run time
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.
2
0
458
May ’24
activitySystemActionForegroundColor(_:) modifier has no effect on action button
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) {```
0
0
282
Apr ’24
Live Activity Stops Updating after iPhone Lock
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?
8
1
946
1w
Pause Live Activity and Dynamic Island
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
0
1
329
Feb ’24
Programmatic Access to ScreenTimeAPI
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!
0
0
305
Feb ’24
Showing a countdown without seconds in ActivityKit
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?
1
0
396
May ’24
Live Activity Text Style Issue in iOS Simulator's lock screen (iOS 17.2)
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.
2
1
467
Jan ’24
LiveActivity crashs in iOS 14
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:)
0
0
289
Jan ’24
Is it possible to implement LiveActivities on an Swift/UIKit project?
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.
0
0
360
Jan ’24
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.
1
0
1.3k
Dec ’23
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
605
Dec ’23