[ad_1]
One of the coolest features Apple will introduce with iOS 16 is the Live Activities function on the new Lock Screen. Although the company has already disclaimed that it won’t be available with version 16.0, what’s changed with beta 4 is that the Live Activities API is now available to developers, which means they can try it out and see how they can implement the function on their apps.
With the framework now available, Apple has also published the documentation on how to display live data on the Lock Screen with live activities on iOS 16.
Live Activities display and update an app’s most current data on the iPhone Lock Screen. This allows people to see live information they care about the most at a glance. To offer Live Activities, add code to your existing widget extension or create a new widget extension if your app doesn’t already include one. Live Activities use WidgetKit functionality and SwiftUI for their user interface on the Lock Screen. ActivityKit’s role is to handle the life cycle of each Live Activity: You use its API to request, update, and end a Live Activity.
With iOS 16, a Live Activity can be active for up to eight hours unless the app or the user explicitly ends it. After this limit, the system automatically ends a Live Activity if the user or the app hasn’t ended it. In this end state, the Live Activity remains on the Lock Screen for up to four additional hours before the system removes it. The user can also choose to remove it. As a result, a Live Activity remains on the Lock Screen for a maximum of 12 hours.
Each Live Activity runs in its own sandbox, and — unlike a widget — it can’t access the network or receive location updates. To update the dynamic data of an active Live Activity, developers will have to use the ActivityKit framework in their app or allow their Live Activities to receive remote push notifications.
Apple has demonstrated during the WWDC 2022 keynote that Live Activities can work for an Uber ride or see whether your Starbucks order is ready.