Live Activities
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 and Live Activities
To facilitate this feature, Netmera has integrated additional functionalities into the existing message delivery framework specifically designed for Live Activity.
Prerequisites and Setup ⚠️
Ensure your Swift SDK version is at least 4.2.0
Starting with iOS 17.2, you can remotely initiate Live Activities via Netmera.
A
.p8 push certificateis required to enable Live Activity updates. Refer to the guide below for instructions on generating an Apple.p8push certificate.
Apple Materials
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.

Netmera Live Activity Sample
You can find a sample project below, which you may use as a reference for your implementation.
Step 1: Define the Live Activity Structure
1.1 Configure Info.plist for Live Activity Support
Info.plist for Live Activity SupportEnsure the following keys are added to your app’s Info.plist
1.2 Implement ActivityAttributes
ActivityAttributesEach Live Activity must define its own custom ActivityAttributes struct. For Netmera compatibility, it must conform to NetmeraLiveActivityAttributes.
netmeraGroupIdis required and must be unique per activity. It allows Netmera to group and update the same activity across multiple users with a single request.ActivityAttributesdefines both static and dynamic properties.ContentStateholds the dynamic fields that can be updated.
Example:
Target Membership Requirement
The file defining the
ActivityAttributesstruct (e.g.,MatchScoreAttributes) must be included in both the main app target (e.g.,NetmeraLiveActivitySample) and the widget extension target (e.g.,NetmeraLiveActivitySampleWidget).In Xcode, select the file and verify under the File Inspector (right-hand panel) that both targets are checked in the Target Membership section.
Failing to configure this correctly will result in the widget extension being unable to access the
ActivityAttributesstruct, causing a build error.

Step 2: Start a Live Activity
You can start an activity remotely or locally:
Remote: You must call the
Netmera.register(forType:name:)method early in your app’s lifecycle, before the push-to-start token is generated, then start an activity using the/rest/3.0/sendBulkNotificationendpoint.Local: Create an instance of your Live Activity, then use the
Netmera.observeActivitymethod to let Netmera manage token and state updates of your activity.
To use remote Live Activity registration, iOS 17.2 or later is required.
2.1. Register Activity Type
To enable Live Activity tracking in iOS 17.2 and later, you must register the Live Activity type with Netmera. This allows Netmera to track and associate push tokens for the specified activity type.
Registration Method
Use the Netmera.register(forType:name:) method to register your Live Activity type.
You can call this method:
Inside
application(_:didFinishLaunchingWithOptions:)in yourAppDelegate, orAt an appropriate point in your app’s lifecycle before showing the Live Activity.
Example use case: When a user adds a team to favorites, you can register the related activity type in advance to prepare for future updates.
Example:
Once registered, Netmera begins listening for push tokens linked to this activity type.
2.2. Start a Live Activity Remotely via Netmera REST API
You can trigger a Live Activity remotely on iOS devices using Netmera’s REST API. The example below demonstrates starting a Live Activity for tracking a football match score.
Required Fields
All fields in the liveActAttr object are mandatory:
groupIDhomeTeamNameawayTeamNamehomeTeamLogoawayTeamLogo
If any of these fields (e.g., awayTeamLogo) are missing, the request will fail, and the Live Activity will not be shown.
Key Parameters
type
Must be "LIVE_ACTIVITY" to activate the Live Activity feature.
contentState
Contains dynamic values that can be updated throughout the activity (e.g. score, match status).
liveActAttr
Contains static metadata used in the widget. All fields are required.
netmeraGroupId
A unique ID that groups the same activity across different users.
homeTeamName
Name of the home team to be displayed in the widget.
awayTeamName
Name of the away team to be displayed.
homeTeamLogo
Media identifier for the home team logo.
awayTeamLogo
Media identifier for the away team logo.
liveActAttrType
Must match the name of your ActivityAttributes Swift class/struct.
sendToAll
Set to true to broadcast the activity to all users. You can replace this with custom targeting if needed.
You can use Apple’s ActivityKit framework to create a Live Activity instance locally on the device. The Netmera SDK manages the push token generated by ActivityKit, enabling you to update Live Activities via the Netmera API. Netmera sends this push token to the Apple Push Notification service (APNs) on the backend.
Steps to Start a Live Activity Locally
Create an instance of your Live Activity using Apple’s
ActivityKitAPIs.Set the
pushTypeparameter to.tokento generate a push token.Pass the previously defined
ActivityAttributesandContentStatewhen creating the activity.Register the Live Activity with Netmera by calling: (This registration step is required only for Live Activities started locally)
Example: LiveActivityManager Class
Below is an example implementation of a manager class that starts a Live Activity for a match score.
Step 3: Resume Activity Tracking
To ensure Netmera continues tracking Live Activities when the app is reopened:
If the app is terminated, its connection with the Live Activity is lost.
To resume tracking token updates or activity state changes, the existing Live Activity must be observed again when the app is relaunched.
This should be handled inside the
application(_:didFinishLaunchingWithOptions:)method of your AppDelegate.Doing so ensures that both locally and remotely started activities are properly re-observed on app launch.
Use the following method:
Example:
Step 4: Update a Live Activity via Netmera REST API
You can update the content of an ongoing Live Activity by sending a REST API request to Netmera:
Step 5: End a Live Activity via Netmera's REST API
To stop a Live Activity, send an END action request via Netmera REST API:
Unregistering a Live Activity
You can stop tracking a specific Live Activity in your app by calling:
Important Notes:
The
nameparameter must exactly match the identifier used during registration withNetmera.register(...).If the names do not match exactly, the unregistration will not take effect.
Example use case: When a user removes a football match from their favorites and no longer wants updates on the lock screen or widget, call the unregister method.
You can stop tracking a specific Live Activity using the Netmera.unregister(name:) method.
Debugging Tip
If you encounter the error:
It indicates that the netmeraGroupId attribute is missing. Ensure it is correctly provided in your ActivityAttributes structure.
Live Activity Analytics
Netmera tracks three system events for Live Activities. These events help you debug the Live Activity lifecycle and analyse adoption and performance from the panel.
You can see all of these events under:
Analytics → Event Insight (left navigation), or
Targeting → User Details → Events tab for a specific user.
Event Overview
LiveActivityStartToken
n:lst
A Live Activity is ready to start and the OS generates a Live Activity start token.
LiveActivityUpdateToken
n:lut
An active Live Activity’s push token changes (e.g., refresh/rotation by the OS).
LiveActivityClose
n:lac
The user closes the Live Activity or it is automatically ended by the system/app.
1. LiveActivityStartToken (n:lst)
n:lst)Description This event is fired when a Live Activity is about to be started and the system creates a start token for that activity.
2. LiveActivityUpdateToken (n:lut)
n:lut)Description This event is fired when an existing Live Activity’s push token changes.
3. LiveActivityClose (n:lac)
n:lac)Description This event is fired when a Live Activity is closed by the user or automatically ended by the system or app (e.g., after a timeout, or when the scenario completes).
Viewing Live Activity Events in the Panel
Event Insight
Go to Analytics → Event Insight from the left menu.
In the Event filter, search by code:
n:lstfor LiveActivityStartTokenn:lutfor LiveActivityUpdateTokenn:lacfor LiveActivityClose
User Details
Go to Targeting → Users and open a specific user profile.
Switch to the Events tab.
Filter or search within the event list for:
LiveActivityStartToken,LiveActivityUpdateToken, orLiveActivityClose
Last updated
Was this helpful?