setupDefault method manages the Live Activity lifecycle for you against a built-in DefaultLiveActivityAttributes type, so the only native code you write is the widget layout.
Requirements
- Your framework’s OneSignal SDK, on a release that bundles OneSignal iOS SDK 5.2.0 or higher. That version added
setupDefaultand push-to-start (for example,react-native-onesignal5.2.0). Follow Mobile SDK setup first. - OneSignal iOS SDK 5.2.15 or higher for click tracking and confirmed receipt. See Live Activities analytics.
- iOS 16.1+ or iPadOS 17+ to start a Live Activity in-app with
startDefault. - iOS 17.2+ to start a Live Activity remotely with the Start Live Activity API. Apple added push-to-start in iOS 17.2, so devices below it can only start activities in-app.
- A .p8 APNs key. Apple does not support p12 certificates with Live Activities.
- Xcode 14 or higher.
Setup
1. Set up the OneSignal SDK
Set up the OneSignal SDK for your framework and initialize it in your app before continuing.React Native
Expo
Flutter
Unity
.NET MAUI
Cordova
Capacitor
2. Call setupDefault on app launch
setupDefault tells the OneSignal SDK to manage the Live Activity lifecycle for its built-in DefaultLiveActivityAttributes type. Call it once per app launch, right after you initialize the OneSignal SDK. The SDK then registers the device’s push-to-start token, which is what lets you start, update, and end the activity with the Start Live Activity and Update Live Activity APIs.
To start an activity from inside your app instead of remotely, call startDefault with an activityId, static attributes, and initial content. Your app must be in the foreground.
setupDefault does nothing on Android. In React Native, guard the call as shown above.setupDefault listens for both push-to-start and push-to-update tokens by default. In React Native and Flutter, pass setup options to enable only one of them. For example, if you always start activities from inside the app, you can skip push-to-start registration.
3. Create the Live Activity widget extension
Update your Info.plist
Info.plist, add the key Supports Live Activities as Boolean, and set it to YES. The raw key name is NSSupportsLiveActivities.
Add Supports Live Activities key to Info.plist and set its value to Boolean YES.
NSSupportsLiveActivitiesFrequentUpdates as a Boolean set to YES (iOS 16.2+). Apple throttles apps that send priority: 10 updates too often, and this key raises that budget. See Update frequency and throttling.Create a Widget Extension

Add a new Widget Extension target for your app in Xcode.
OneSignalWidget) and ensure Include Live Activity is selected. Then click Finish.
Widget Extension options for a Live Activity.

Scheme activation prompt: select Don't Activate.
Add the OneSignalLiveActivities subspec to your Podfile (optional)
OneSignalWidgetExtension.
Find the name of your widget extension target.
Podfile and add only the OneSignalXCFramework/OneSignalLiveActivities subspec. Replace OneSignalWidgetExtension with the name of your widget extension target. Do not use the aggregate pod 'OneSignalXCFramework' declaration, which resolves OneSignalComplete and includes the location module.pod repo update && pod install to install the OneSignalLiveActivities pod.4. Build the widget layout
In Xcode, open theWidgetExtensionLiveActivity.swift file that the Widget Extension template generated.
Open the Inspector panel on the right side of the screen. Within Target Membership, click the + button and select your main app target. In Flutter this target is named Runner. In other frameworks it matches your app name.

Allow main target membership for the Live Activity file.
ActivityAttributes struct yourself, because setupDefault supplies DefaultLiveActivityAttributes, which exposes your payload as context.attributes.data and context.state.data.
@available(iOS 16.2, *) annotation from the template. A widget gated this way does not render on iOS 16.1, so treat 16.2 as the practical floor for this setup. Set widgetURL to your own deep link, since the example points at apple.com.Test the Live Activity
Build and run your app on a device or simulator running iOS 17.2 or higher, then send a start request. Two fields carry your widget’s data, and both mirror the structure your Swift layout reads:event_attributesholds static data. You set it in the start request and it stays fixed for the life of the activity. Your widget reads it ascontext.attributes.data.event_updatesholds dynamic data you change on later updates. Your widget reads it ascontext.state.data. Nest values exactly as your layout expects, so themessagedictionary below arrives ascontext.state.data["message"]["en"].
YOUR_APP_IDwith your OneSignal App ID andYOUR_REST_API_KEYwith your API key.activity_idwith an identifier of your choice. A new value starts a new Live Activity, and reusing a value updates the activity already using it. See Choose an activity ID.
DefaultLiveActivityAttributes in the URL path as-is. That is the type setupDefault registers, and the path segment is case-sensitive. For every available field, see the Start Live Activity API reference.
Low-level methods
Use these methods only if you want to define your ownActivityAttributes struct in Swift and manage the push-to-start token yourself, instead of letting setupDefault own the lifecycle. You generate the token with ActivityKit in your iOS code, then hand it to OneSignal. For the native side, see the alternative setup notes in the iOS SDK.
activityType must be the name of the struct conforming to ActivityAttributes that starts the activity, and it becomes the last segment of the API URL path.
FAQ
Why does my Live Activity never start from a push?
The most common cause is a device below iOS 17.2. Apple added push-to-start in iOS 17.2, so older devices can only start activities in-app withstartDefault. If the device qualifies, check that setupDefault runs on every app launch after OneSignal.initialize, that the activity type in your URL path is exactly DefaultLiveActivityAttributes, and that your app uses a .p8 APNs key rather than a p12 certificate.
Do I need to define my own ActivityAttributes struct?
No.setupDefault registers the SDK’s DefaultLiveActivityAttributes type, which is why the widget reads values through context.attributes.data and context.state.data instead of named properties. Define your own struct only if you use the low-level methods.
Why is my widget showing default or empty values?
Your payload nesting does not match what the layout reads.event_attributes maps to context.attributes.data and event_updates maps to context.state.data, so a value the widget reads as context.state.data["message"]["en"] must arrive as event_updates.data.message.en. Values that miss the expected path fall back to the defaults in your Swift code.
Can I use Live Activities on Android?
No. Live Activities are an iOS-only ActivityKit feature, so the calls on this page do nothing on Android. For a comparable Android experience built on push notifications, see Android Live Updates.Does the widget need its own OneSignal pod?
Only if your app uses CocoaPods. In that case add theOneSignalXCFramework/OneSignalLiveActivities subspec to your widget extension target, as shown in step 3. Do not add the aggregate OneSignalXCFramework pod to the widget target, because it resolves OneSignalComplete and pulls in the location module.
Related pages
Live Activities
Live Activities developer setup
ActivityAttributes.