Live activities
A live activity is a notification that starts, updates in place and ends: a match score, a delivery, a countdown. On iPhone it is a Live Activity on the Lock Screen and in the Dynamic Island. On Android it is an ongoing notification, shown as a promoted Live Update on Android 16 QPR1 or later, though the phone may refuse it.
Paste it into Claude Code, Cursor or another coding agent and it will add live activities to your app.
View prompt
Add PushPilot live activities (iOS Live Activities and Android Live Updates) to this app. PushPilot starts, updates and ends them by push; the app never starts one itself.
First work out what kind of project this is: native iOS (Swift), native Android (Kotlin or Java), React Native or Flutter. Follow only the part for that kind, plus the iOS steps it points to. If the app does not use PushPilot for push yet, stop and tell me: PushPilot push must be set up first.
SDK key: use only the public PushPilot SDK key (it starts with pp_sdk_ and is safe to commit). Read it from the project's existing PushPilot setup; if there is none, ask me for it.
## Native iOS
1. Update the PushPilot iOS SDK to 2.2.0: the pushpilot-ios Swift package (from: "2.2.0").
2. Check the app target has the Push Notifications capability (the aps-environment entitlement). Add it in the project if it is missing.
3. Add NSSupportsLiveActivities (Boolean, YES) to the app's Info.plist. Without it iOS starts none.
4. Add a Widget Extension target (File › New › Target › Widget Extension, for example named LiveActivity) with the template's "Include …" options unticked. Its bundle id must start with the app's, its deployment target must be iOS 16.1 or later and its signing team the app's. Delete the generated widget files except the bundle.
5. Add the PushPilotLive library to the Widget Extension target only: the PushPilotLive product of the pushpilot-ios Swift package. The app target needs nothing more.
6. Make the extension's bundle return PushPilot's widget, which draws every PushPilot layout on the Lock Screen and in the Dynamic Island:
// In your Widget Extension (add the PushPilotLive library to it)
import PushPilotLive
import SwiftUI
import WidgetKit
@main
struct LiveWidgets: WidgetBundle {
var body: some Widget {
PushPilotLiveActivityWidget(appGroup: "group.com.example.app")
}
}
7. Add an App Group (for example group.<app bundle id>) to both the app and the extension, and pass the same group to the widget above and to initialize, so the app can download layout images for the widget.
8. Pass every URL the app opens to PushPilot.handleLiveActivityURL. It counts the tap on a live activity and returns the activity's own link, or nil when it has none; other URLs come back unchanged. In UIKit, do the same from scene(_:openURLContexts:) or application(_:open:options:).
// In your app
PushPilot.initialize(sdkKey: "pp_sdk_…", appGroup: "group.com.example.app")
// SwiftUI: count taps and open your own link
.onOpenURL { url in
if let link = PushPilot.handleLiveActivityURL(url) { router.open(link) }
}
Live activities started by push need iOS 17.2 or later; the app's own deployment target does not change.
## Native Android
Update ai.pushpilot:sdk to 2.2.0. Nothing else to add: the SDK draws live activities from the PushPilot pushes it already handles through PushPilot.handleMessage, and its manifest merges the POST_PROMOTED_NOTIFICATIONS permission. Check that every FCM message still reaches PushPilot.handleMessage.
## React Native
1. Update @pushpilotai/react-native to 2.2.0, then run pod install in ios/.
2. Android needs nothing more.
3. iOS: do the native iOS steps 2 to 7 above in ios/<App>.xcworkspace. The Widget Extension uses no pods: add PushPilotLive to it as a Swift package product, and leave the Podfile alone.
4. Pass the App Group to init, and pass opened URLs (Linking.getInitialURL and the url event) to handleLiveActivityURL:
// React Native
PushPilot.init('pp_sdk_…', { appGroup: 'group.com.example.app' });
const link = await PushPilot.handleLiveActivityURL(url);
## Flutter
1. Update pushpilot_flutter to ^2.2.0 in pubspec.yaml and run flutter pub get.
2. Android needs nothing more.
3. iOS: do the native iOS steps 2 to 7 above in ios/Runner.xcworkspace. Add the PushPilotLive product of the pushpilot-ios Swift package to the extension target. The Runner target needs nothing more.
4. Pass the App Group to init, and pass opened URLs to handleLiveActivityURL:
// Flutter
await PushPilot.init('pp_sdk_…', appGroup: 'group.com.example.app');
final link = await PushPilot.handleLiveActivityURL(url);
## Do not
- Never put a push credential in the app (an APNs .p8 key, a Firebase service account JSON or any server API key). PushPilot holds those.
- Do not swizzle, and do not add any dependency other than the PushPilot SDK and PushPilotLive.
- Do not start, update or end live activities from app code.
## Things only I can do
Stop and list these for me instead of guessing: signing for the new extension in Xcode, registering the App Group and turning on capabilities for the App IDs in Apple's developer portal, and, for iOS 18 broadcast updates, the Broadcast capability on the App ID plus "Broadcast updates" in the app's PushPilot settings.
## Check it worked
Build and open the app once on a device (iOS 17.2 or later, or any Android 6 or later) with notifications allowed, so the SDK reports that it can show live activities. Then in the PushPilot dashboard open Messages, choose Live activity and pick a template: the reach line counts the device under iOS or Android. Start a short test activity to it and check it shows, updates and ends. On iOS, tap Allow under the first activity on the Lock Screen: iOS asks once per app, and until the person allows, the activity gets no updates.Where it works
- iOS 17.2 and later, started by push. Earlier iOS versions do not receive them.
- iOS 18 can receive shared updates on one Apple broadcast channel (see below).
- Android 6 and later with SDK 2.2.0 or later. The promoted look needs Android 16 QPR1 or later, and the phone may refuse it.
- React Native and Flutter with their 2.2.0 SDKs or later.
- Web push has no live activities: browsers have nothing like them.
An activity lasts at most 8 hours, and each push is at most 4 KB. Those are Apple's limits, and PushPilot applies them on every platform.
Set up your iOS app
- Update to the PushPilot iOS SDK 2.2.0 and add
NSSupportsLiveActivities= YES to the app's Info.plist. - Add a Widget Extension target, and add the
PushPilotLivelibrary to it (Swift Package Manager product, orpod 'PushPilotLive'in the extension's Podfile target). - Create an App Group and turn it on for both the app and the extension, so the app can download layout images for the widget.
- Return PushPilot's widget from the extension, and pass the App Group to
initialize. - Pass opened URLs to
handleLiveActivityURL: it counts the tap and gives back your own link.
// In your Widget Extension (add the PushPilotLive library to it)
import PushPilotLive
import SwiftUI
import WidgetKit
@main
struct LiveWidgets: WidgetBundle {
var body: some Widget {
PushPilotLiveActivityWidget(appGroup: "group.com.example.app")
}
}// In your app
PushPilot.initialize(sdkKey: "pp_sdk_…", appGroup: "group.com.example.app")
// SwiftUI: count taps and open your own link
.onOpenURL { url in
if let link = PushPilot.handleLiveActivityURL(url) { router.open(link) }
}// React Native
PushPilot.init('pp_sdk_…', { appGroup: 'group.com.example.app' });
const link = await PushPilot.handleLiveActivityURL(url);
// Flutter
await PushPilot.init('pp_sdk_…', appGroup: 'group.com.example.app');
final link = await PushPilot.handleLiveActivityURL(url);iOS asks the user once
Android needs no setup
What Started counts
Templates
A template is the activity's look: blocks such as text, icons, images, a progress bar and a timer, placed on the Lock Screen and in each Dynamic Island region, plus the fields its state holds. Start from the gallery, design your own in App settings → Live templates with a preview of every view, or use Describe it to have PushPilot AI write one. Animated images and video do not play on either platform.
Text can be personal: {{attr.first_name|there}} uses a device attribute with a fallback, and {{user.external_id}} the user's id. Values are filled in per device when each push is sent.
Four ways to send
- Messages: choose Live activity, a template, its values, the audience, the end time and any updates known in advance. The activity's page sends updates and ends it.
- Campaigns on an app: open a scheduled notification and choose Make live. Times are in minutes after the notification, so rescheduling moves the whole activity.
- Your backend, with a server API key: start, update and end by your own key.
- PushPilot AI proposes or starts live activities for events it knows in advance, following its autonomy settings. Optional daily and weekly limits are in its settings. Your backend can update the same activity by the key it sets.
curl -X POST "$PUSHPILOT_URL/api/v1/live-activities" \
-H "Authorization: Bearer $PUSHPILOT_KEY" \
-H "Idempotency-Key: order-42-start" \
-H "Content-Type: application/json" \
-d '{
"key": "order-42",
"template": "Delivery",
"attributes": {"name": "Order 42", "url": "myapp://orders/42"},
"state": {"title": "Being packed", "progress": 0.2},
"target": {"external_user_ids": ["user-17"]},
"ends_at": "2026-12-01T21:00:00Z"
}'
curl -X POST "$PUSHPILOT_URL/api/v1/live-activities/order-42/updates" \
-H "Authorization: Bearer $PUSHPILOT_KEY" \
-H "Idempotency-Key: order-42-out" \
-H "Content-Type: application/json" \
-d '{"state": {"title": "Out for delivery", "progress": 0.7}}'iOS 18 broadcast updates
With Broadcast updates on in your iOS app's settings, an activity with the same content for everyone sends each update once to an Apple channel instead of once per device. First turn on the Broadcast capability for the App ID in Apple's developer portal. Billing still counts one notification per device per update.
Content
PushPilot restricts no content. For your information: Apple's guidelines and Google's Live Update guidance say live activities are not for ads or promotions, and Android may decline to promote a notification. That is between you and the platform.