🔥Live Activities
Last updated
Last updated
Live Activities enable apps to display dynamic, real-time updates directly on glanceable areas like the Lock Screen, iPhone StandBy, Dynamic Island, and Apple Watch’s Smart Stack, allowing users to monitor ongoing events, activities, or tasks without constantly reopening the app.
Ideal for tracking short-to-medium-length tasks, Live Activities present prioritized information such as live sports scores, delivery updates, or fitness metrics, and can offer interactive options for user control. For best practices, ensure a concise layout suited to all display locations, avoid sensitive information, and refrain from using Live Activities for advertising, preserving them as a tool for useful, timely updates.
Netmera now supports Apple’s Live Activity, enabling real-time updates and interactions directly within targeted user groups. By combining Netmera's targeting capabilities with Live Activity, you can initiate, update, and track ongoing events or tasks, providing users with glanceable information on their Lock Screen or Dynamic Island.
To facilitate this feature, Netmera has integrated additional functionalities into the existing message delivery framework specifically designed for Live Activity.
Ensure your iOS SDK version is at least 3.24.0
A p8 push certificate is required to enable Live Activity updates.
Starting with iOS 17.2, you can remotely initiate Live Activities via Netmera.
This guide outlines the steps to initiate, update, and end Live Activity with Netmera’s API, enabling dynamic notifications on iOS devices. Below are the essential setup instructions, endpoint examples, and details on how to manage the lifecycle of a Live Acxtivity.
Starter Token Transmission to Netmera
Starting the Live Activity
Updating the Live Activity with an Update Token
Modifying or Ending the Live Activity
Monitoring the Close Event
To initiate a Live Activity, Netmera requires the Starter Token provided by Apple. This token is obtained once the activity is ready to begin and is transmitted to Netmera using the LiveActivityStartToken
event.
Starter Token: This token is essential to start a Live Activity on the user’s device.
Using Netmera’s REST API, you can initiate a Live Activity with either sendBulkNotification
or sendNotification
. Here are examples and descriptions of the parameters used.
sendBulkNotification
The following curl
example demonstrates how to start a Live Activity for iOS:
Parameter Descriptions
contentState: This dynamic, stateful section of the Live Activity is used for updates. In this example, the emoji is set as "Apple"
. Defined in Swift as:
liveActAttrType: Specifies the model class used in Swift to define the activity, here set as "LiveActivityAttributes"
.
liveActAttr: Contains static content that remains fixed for the Live Activity lifecycle, such as name
.
sendNotification
For individual Live Activity notifications, use the createNotificationDefinition
API to define the notification, then send it via sendNotification
.
Define the Notification:
Send the Notification:
After executing these commands, the Live Activity will appear on the user’s device.
Update Token: This token is used to modify an ongoing Live Activity. Once the Live Activity is started, Apple provides an update token. Transmit this token to Netmera using the LiveActivityUpdateToken
event, including the group_id.
Use the update-live-activity
API to either modify the content of an existing Live Activity or end it based on the action specified.
groupId: Identifier of the Live Activity group.
action: Defines the operation type (either "UPDATE"
or "END"
).
contentState: Specifies the updated information within the Live Activity.
To end a Live Activity, set the action to END
:
When the end-user closes the Live Activity in the notification center, this action should be tracked and reported to Netmera using the LiveActivityClose
event with the associated group_id.
Note:
Both the starter and update tokens may change over the lifecycle of the Live Activity. Always ensure Netmera receives the latest token data to maintain updates.