Functions that allow an Eitri-App to create and manage order tracking live notifications.

Live notifications display real-time order status updates on the lock screen and Dynamic Island, providing users with at-a-glance information about their order progress without opening the app.

Platform Support:

  • ✅ iOS 16.2 and later (implemented as Live Activities)
  • ✅ Android 16 (API 36) and later (implemented as Live Updates / promoted ongoing notifications)
  • ❌ iOS versions below 16.2 (not supported)
  • ❌ Android versions below 16 (not supported)

Important Notes:

  • Only one live notification per orderId can be active at a time

Methods

  • Ends a specific order tracking live notification.

    Dismisses the live notification from the user's lock screen and Dynamic Island. The notification is removed immediately.

    Platform Support: iOS 16.2+ and Android 16 (API 36)+. Throws error on unsupported platforms.

    Example:

    const modules = await Eitri.modules()
    const liveNotificationEnd = modules.orderStatusLiveNotification?.end
    if (!liveNotificationEnd) return

    try {
    await liveNotificationEnd({
    orderId: "12345"
    })
    console.log("Live notification ended successfully")
    } catch (error) {
    console.error("Failed to end live notification:", error)
    }

    Parameters

    Returns Promise<void>

    Promise that resolves when the live notification is dismissed

    Error if the live notification for orderId doesn't exist or if platform is not supported

  • Ends all active order tracking live notifications for the current user.

    Dismisses all live notifications associated with the app, regardless of order ID. Useful for cleanup operations like user logout.

    Platform Support: iOS 16.2+ and Android 16 (API 36)+. No-op on unsupported platforms.

    When to call:

    • User logs out
    • App needs to clear all notifications (e.g., account deletion)

    Example:

    // Clear all live notifications on logout
    async function handleLogout() {
    const modules = await Eitri.modules()
    const liveNotificationEndAll = modules.orderStatusLiveNotification?.endAll
    if (liveNotificationEndAll) {
    await liveNotificationEndAll()
    }
    // Continue with logout flow...
    }

    Returns Promise<void>

    Promise that resolves when all live notifications are dismissed

  • Retrieves information about all currently active order tracking live notifications.

    Returns a list of all live notifications currently displayed for the user, including their order IDs and activity IDs.

    Platform Support: iOS 16.2+ and Android 16 (API 36)+. Returns empty array on unsupported platforms.

    Use cases:

    • Check if a specific order already has an active live notification
    • Display list of tracked orders in your app UI
    • Sync app state with active live notifications

    Example:

    const modules = await Eitri.modules()
    const liveNotificationGetActiveNotifications = modules.orderStatusLiveNotification?.getActiveNotifications
    if (!liveNotificationGetActiveNotifications) return

    const activities = await liveNotificationGetActiveNotifications()
    console.log(`${activities.length} active order notifications`)

    activities.forEach(activity => {
    console.log(`Order ${activity.orderId} - Activity ${activity.activityId}`)
    })

    // Check if specific order is being tracked
    const isTracking = activities.some(a => a.orderId === "12345")

    Returns Promise<LiveNotificationActivityInfo[]>

    Promise resolving to array of active live notification info. Empty array if none active.

  • Checks if order tracking live notifications are supported on the current device.

    This method verifies:

    • Device is running iOS 16.2+ or Android 16 (API 36)+
    • User has live notifications enabled in system settings
    • App has live notifications properly configured

    Platform Support: Returns false on iOS < 16.2 and Android < 16.

    Permissions: A supported device does not imply the OS notification permission is granted. Validate it separately with Eitri.notification.checkPermission() (and request it with Eitri.notification.requestPermission()) before calling start. See the Notification API reference.

    Example:

    const modules = await Eitri.modules()
    const liveNotificationIsSupported = modules.orderStatusLiveNotification?.isSupported
    if (!liveNotificationIsSupported) return

    const supported = await liveNotificationIsSupported()
    if (!supported) {
    console.log("Live notifications not available on this device")
    // Fallback to push notifications or in-app updates
    }

    Returns Promise<boolean>

    Promise resolving to true if live notifications are available, false otherwise.

  • Starts a new order tracking live notification for the specified order.

    Creates a live notification (an iOS Live Activity, or an Android 16+ Live Update) that displays on the user's lock screen / Dynamic Island (iOS) or status bar chip / lock screen (Android), showing real-time order status updates.

    Platform Support: iOS 16.2+ and Android 16 (API 36)+. Throws error on unsupported platforms.

    Permissions: Live notifications require the OS notification permission. This module does not request it for you — call Eitri.notification.requestPermission() before calling start and proceed only when its status is "GRANTED". Calling start without the permission granted will not display a notification. (Use Eitri.notification.checkPermission() for read-only UI state, e.g. enabling/disabling a button — not as the gate before start, since on Android a blocked permission is only revealed by a request.) See the Notification API reference.

    Important:

    • Only one live notification per orderId can be active
    • If a live notification already exists for the orderId, returns existing activity info
    • The notification persists across app restarts until explicitly ended

    Example:

    const modules = await Eitri.modules()
    const liveNotificationStart = modules.orderStatusLiveNotification?.start
    if (!liveNotificationStart) return

    // Ensure the OS notification permission is granted before starting.
    const permission = await Eitri.notification.requestPermission()
    if (permission.status !== "GRANTED") return // user declined; do not start

    try {
    const result = await liveNotificationStart({
    orderId: "12345",
    orderIdDisplayText: "Order #ORD-12345",
    storeName: "Test Store",
    status: {
    displayName: "Confirmed",
    icon: "checkmark.circle",
    progress: 0.25
    },
    message: "Your order has been confirmed",
    estimatedTime: "30 min"
    })
    console.log("Live notification started:", result.activityId)
    } catch (error) {
    console.error("Failed to start live notification:", error)
    }

    Parameters

    Returns Promise<StartLiveNotificationResult>

    Promise resolving to activity information including activityId and orderId

    Error if live notifications are not supported or if required parameters are missing

  • Updates an existing order tracking live notification with new status information.

    Updates the live notification on the user's lock screen and Dynamic Island with new order status, progress, message, and estimated time.

    Platform Support: iOS 16.2+ and Android 16 (API 36)+. Throws error on unsupported platforms.

    Update Methods:

    Live notifications can be updated in two ways:

    1. From the app - Using this method directly (as shown in examples below)
    2. From server - Using push notifications (APNs on iOS, FCM data messages on Android)

    On iOS, starting a live notification registers a per-activity push token with APNs. On Android, the server reuses the app's existing FCM device token and addresses updates by orderId. Either way the Eitri server can send remote updates, allowing the live notification to update even when the app is not running.

    Common Update Scenarios:

    • Order confirmed → Preparing
    • Preparing → Out for delivery
    • Out for delivery → Delivered

    Example (update to preparing):

    const modules = await Eitri.modules()
    const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
    if (!liveNotificationUpdate) return

    try {
    await liveNotificationUpdate({
    orderId: "12345",
    status: {
    displayName: "Preparing",
    icon: "flame",
    progress: 0.5
    },
    message: "Your order is being prepared",
    estimatedTime: "25 min"
    })
    } catch (error) {
    console.error("Failed to update live notification:", error)
    }

    Example (update to out for delivery):

    const modules = await Eitri.modules()
    const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
    if (!liveNotificationUpdate) return

    await liveNotificationUpdate({
    orderId: "12345",
    status: {
    displayName: "Out for delivery",
    icon: "truck.box",
    progress: 0.75
    },
    message: "Your order is on it's way",
    estimatedTime: "10 min"
    })

    Example (update to delivered):

    const modules = await Eitri.modules()
    const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
    if (!liveNotificationUpdate) return

    await liveNotificationUpdate({
    orderId: "12345",
    status: {
    displayName: "Delivered",
    icon: "checkmark.circle.fill",
    progress: 1.0
    },
    message: "Your order has been delivered",
    })

    Parameters

    Returns Promise<void>

    Promise that resolves when the update is complete

    Error if the live notification for orderId doesn't exist or if platform is not supported