Guide for building CarPlay quick-ordering apps (food ordering, pickup, etc.) using the CarPlay framework. Use this skill whenever the user wants to build a CarPlay ordering app, integrate CarPlay templates for food/drink/pickup ordering, work with CPPointOfInterestTemplate, CPListTemplate, CPTabBarTemplate, or CPInterfaceController for ordering workflows. Also trigger when the user mentions CarPlay entitlements, Live Activities with CarPlay ordering, or push notification updates for order status. Covers the full lifecycle: entitlement setup, template hierarchy, map-based POI selection, order placement, Live Activity integration, and push token management.
Guide for building CarPlay quick-ordering apps (food ordering, pickup, etc.) using the CarPlay framework. Use this skill whenever the user wants to build a CarPlay ordering app, integrate CarPlay templates for food/drink/pickup ordering, work with CPPointOfInterestTemplate, CPListTemplate, CPTabBarTemplate, or CPInterfaceController for ordering workflows. Also trigger when the user mentions CarPlay entitlements, Live Activities with CarPlay ordering, or push notification updates for order status. Covers the full lifecycle: entitlement setup, template hierarchy, map-based POI selection, order placement, Live Activity integration, and push token management.
CarPlay Quick-Ordering App Integration
Build a CarPlay-enabled ordering app that displays custom ordering options in a vehicle using Apple's CarPlay framework.
When to Use This Skill
Building a food/drink ordering app with CarPlay support
Integrating CPPointOfInterestTemplate, CPListTemplate, or CPTabBarTemplate
Setting up CarPlay entitlements and provisioning profiles
Implementing order status with Live Activities from a CarPlay context
Handling map region changes and location-based search in CarPlay
Managing push notifications for order status updates
After a user places an order, start a Live Activity to show status on the Lock Screen. Live Activities don't display in CarPlay but provide glanceable updates:
let attrs =OrderStatusAttributes(order: order)
let initialState =OrderStatusAttributes.ContentState(
isPickedUp: false,
isReady: false,
isPreparing: false,
isConfirmed: true
)
let activity =tryActivity.request(
attributes: attrs,
content: .init(state: initialState, staleDate: Date(timeIntervalSinceNow: 60*30)),
pushType: .token
)
Listening for Updates
Set up listeners for content updates, state changes, and push token updates. This is critical because quick-ordering apps spend time in the background — use push notifications for updates:
// Content updatesTask { @MainActorinforawait change in activity.contentUpdates {
try saveOrderState(state: change.state)
WidgetCenter.shared.reloadAllTimelines()
}
}
// Activity state (ended/dismissed)Task { @MainActorinforawait state in activity.activityStateUpdates {
if state == .dismissed || state == .ended {
await activity.end(nil, dismissalPolicy: .immediate)
}
WidgetCenter.shared.reloadAllTimelines()
}
}
// Push token for remote updatesTask { @MainActorinforawait pushToken in activity.pushTokenUpdates {
let tokenString = pushToken.reduce("") { $0+String(format: "%02x", $1) }
tryawait sendPushToken(order: order, pushTokenString: tokenString)
}
}
Push Notification JWT
For server-side push notifications to update Live Activities, create a JWT using P256 signing:
let privateKey =tryP256.Signing.PrivateKey(pemRepresentation: pemString)
let header =tryJSONEncoder().encode(header).urlSafeBase64EncodedString()
let payload =tryJSONEncoder().encode(payload).urlSafeBase64EncodedString()
let toSign =Data((header +"."+ payload).utf8)
let signature =try privateKey.signature(for: toSign)
let token = [header, payload, signature.rawRepresentation.urlSafeBase64EncodedString()]
.joined(separator: ".")
Key Design Considerations
12 POI limit — CarPlay displays a maximum of 12 points of interest at once
Background updates — Use push notifications, not foreground polling, since quick-ordering apps spend most time in background
Location is essential — Handle all authorization states gracefully; the app depends on location for relevant results
Live Activities — They don't render in CarPlay, but provide Lock Screen status updates
Stale dates — Set reasonable stale dates on Live Activity content (e.g., 30 minutes for food orders)
Token management — Cache and refresh JWTs; listen for push token changes on the activity