Swift
Syntax
Copied to your clipboardstatic func registerLiveActivities(_ activityTypes: [any LiveActivityAttributes.Type])
- activityTypes is an array of types conforming to the
LiveActivityAttributesprotocol. Each type represents a Live Activity that will be monitored for push-to-start tokens (iOS 17.2+), activity update tokens, and lifecycle events.
Example
Copied to your clipboardimport AEPMessagingimport AEPMessagingLiveActivityimport ActivityKit// Register a single Live Activity typeif #available(iOS 16.1, *) {Messaging.registerLiveActivities([FoodDeliveryLiveActivityAttributes.self])}// Register multiple Live Activity typesif #available(iOS 16.1, *) {Messaging.registerLiveActivities([AirplaneTrackingAttributes.self,FoodDeliveryLiveActivityAttributes.self,GameScoreLiveActivityAttributes.self])}
Objective-C
The registerLiveActivities API is only available in Swift. ActivityKit and its ActivityAttributes protocol are Swift-only APIs and cannot be called from Objective-C.
