Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
facebook avatar

Session Lifecycle

  • 5 installs
  • 500 repo stars
  • Updated August 3, 2026
  • facebook/meta-wearables-dat-ios

Manage Meta Wearables DAT SDK device session states (idle, starting, started, paused, stopped) and stream transitions, monitoring glasses availability.

About

Describes DAT SDK device session states, stream state transitions, pause/resume rules, and device availability monitoring for Meta glasses. A developer uses it to correctly observe session state and avoid restarting streams while paused.

  • Full session state table with the app action for each state
  • Do not restart during paused; create a new session after stopped

Session Lifecycle by the numbers

  • 5 all-time installs (skills.sh)
  • Ranked #828 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/facebook/meta-wearables-dat-ios --skill session-lifecycle

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs5
repo stars500
Last updatedAugust 3, 2026
Repositoryfacebook/meta-wearables-dat-ios

What it does

Manage Meta Wearables DAT SDK device session states (idle, starting, started, paused, stopped) and stream transitions, monitoring glasses availability.

Files

SKILL.mdMarkdownGitHub ↗

Session Lifecycle (iOS)

Guide for managing device session states in DAT SDK integrations.

Overview

The DAT SDK runs work inside sessions. Meta glasses expose two experience types:

  • Device sessions — sustained access to device sensors and outputs
  • Transactions — short, system-owned interactions (notifications, "Hey Meta")

Your app observes session state changes — the device decides when to transition.

Session states

StateMeaningApp action
idleSession created but not startedCall start() when ready
startingSession is connecting to the deviceShow connecting state
startedSession active and ready for capabilitiesAdd or resume work
pausedTemporarily suspended by the deviceHold work, may resume
stoppingSession is cleaning upWait for terminal state
stoppedSession inactive and terminalFree resources, create a new session to restart

Observing session state

let session = try Wearables.shared.createSession(deviceSelector: AutoDeviceSelector(wearables: Wearables.shared))
try session.start()

Task {
    for await state in session.stateStream() {
        switch state {
        case .started:
            // Confirm UI shows session is live
        case .paused:
            // Keep connection, wait for started or stopped
        case .stopped:
            // Release resources, allow user to restart
        default:
            break
        }
    }
}

Stream state transitions

A Stream is a capability attached to a started DeviceSession:

stopped → waitingForDevice → starting → streaming → paused → stopped
guard let stream = try session.addStream(config: StreamConfiguration()) else { return }

let token = stream.statePublisher.listen { state in
    Task { @MainActor in
        // React to state changes
    }
}

Common transitions

The device changes session state when:

  • User performs a system gesture that opens another experience
  • Another app starts a device session
  • User removes or folds the glasses (Bluetooth disconnects)
  • User removes the app from Meta AI companion app
  • Connectivity between companion app and glasses drops

Pause and resume

When a session is paused:

  • The device keeps the connection alive
  • Streams stop delivering data
  • The device may resume by returning to started

Your app should not attempt to restart while paused — wait for started or stopped.

Device availability

Monitor device availability to know when sessions can start:

Task {
    for await devices in Wearables.shared.devicesStream() {
        // Update list of available glasses
    }
}

Key behaviors:

  • Closing hinges disconnects Bluetooth → forces stopped
  • Opening hinges restores Bluetooth but does not restart sessions
  • Start a new session after the device becomes available again

Implementation checklist

  • [ ] Handle all relevant session states (started, paused, stopped)
  • [ ] Monitor device availability before starting work
  • [ ] Release resources only after stopped
  • [ ] Don't infer transition causes — rely only on observable state
  • [ ] Don't restart during paused — wait for system to resume or stop

Links

Related skills

Mobile Developmentintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.