원클릭으로
session-lifecycle
Device session states, pause/resume, availability monitoring
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Device session states, pause/resume, availability monitoring
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Stream, video frames, photo capture, resolution/frame rate configuration
Swift patterns, async/await, naming conventions, key types for DAT SDK iOS development
Display capability setup, display-capable device selection, UI DSL, icons, buttons, images, and video playback
SDK setup, Swift Package Manager integration, Info.plist configuration, and first connection to Meta glasses
MockDeviceKit for testing without physical glasses hardware
Building a complete DAT app with camera streaming and photo capture
| name | session-lifecycle |
| description | Device session states, pause/resume, availability monitoring |
Guide for managing device session states in DAT SDK integrations.
The DAT SDK runs work inside sessions. Meta glasses expose two experience types:
Your app observes session state changes — the device decides when to transition.
| State | Meaning | App action |
|---|---|---|
idle | Session created but not started | Call start() when ready |
starting | Session is connecting to the device | Show connecting state |
started | Session active and ready for capabilities | Add or resume work |
paused | Temporarily suspended by the device | Hold work, may resume |
stopping | Session is cleaning up | Wait for terminal state |
stopped | Session inactive and terminal | Free resources, create a new session to restart |
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
}
}
}
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
}
}
The device changes session state when:
When a session is paused:
startedYour app should not attempt to restart while paused — wait for started or stopped.
Monitor device availability to know when sessions can start:
Task {
for await devices in Wearables.shared.devicesStream() {
// Update list of available glasses
}
}
Key behaviors:
stoppedstarted, paused, stopped)stoppedpaused — wait for system to resume or stop