session-lifecycle

Manage Meta glasses device session state transitions via the SDK state stream.

506|113|Updated Nov 21, 2025
One-click install
npx skills add https://github.com/facebook/meta-wearables-dat-ios --skill session-lifecycle-facebook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-lifecycle
Source: https://github.com/facebook/meta-wearables-dat-ios/tree/main/plugins/mwdat-ios/skills/session-lifecycle
Command: npx skills add https://github.com/facebook/meta-wearables-dat-ios --skill session-lifecycle-facebook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing Meta glasses device sessions is non-trivial because the device controls when a session starts, pauses, resumes, and stops, so apps must react correctly to avoid broken streaming, wasted work, or resource leaks.

Core Features & Use Cases

  • Session state management: Understand and handle idle, starting, started, paused, stopping, and stopped with appropriate app behavior.
  • Observing session changes: Process session updates via an async stream (e.g., stateStream()) so UI and work react to real device transitions.
  • Capability/stream lifecycle alignment: Track stream state transitions on a started device session and respond to changes like paused vs stopped.
  • Device availability monitoring: Use device availability streams to start new sessions only when the glasses are connectable, and avoid assuming automatic restarts after re-availability.

Quick Start

Create a session, start it, and listen to session.stateStream() to update your UI and pause work when you receive .paused and to release resources only when you receive .stopped.

Frequently Asked Questions about session-lifecycle

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle Meta glasses device session lifecycle states in my iOS app?

Observe the SDK's async stateStream() to handle session lifecycle states like idle, started, paused, and stopped, ensuring your iOS app reacts correctly to device-controlled transitions without resource leaks.

Why do I need to monitor device availability before starting a session for Meta glasses?

You need to monitor device availability before starting a session because Meta glasses do not automatically restart sessions after re-availability, requiring you to use availability streams to initiate new sessions only when the device is connectable.

What is the best way to pause and resume streaming capability data on iOS wearables?

The best way to pause and resume streaming capability data is to track stream state transitions on a started device session, responding to paused states by pausing work and releasing resources only when fully stopped.

How do I prevent resource leaks when a Meta glasses session stops unexpectedly?

Prevent resource leaks when a session stops unexpectedly by listening to the stateStream() and explicitly releasing resources only upon receiving the stopped state, while pausing non-essential work during the paused state.

Does the Meta glasses SDK support async streams for monitoring session state changes on iOS?

Yes, the SDK supports async streams for monitoring session state changes on iOS, allowing you to process updates via stateStream() so your UI and background work react to real device transitions.