/mwdat-android:dat-conventionsfrom mwdat-android
Provides Kotlin patterns, DatResult error handling, session lifecycle, and capability conventions for DAT SDK Android development.
Ships in mwdat-android. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
| Task | Command |
|---|---|
| Build app | ./gradlew assembleDebug |
| Run tests | ./gradlew test |
| Install app | ./gradlew installDebug |
| Lint app | ./gradlew lint |
The SDK is organized into four public modules:
DeviceSession.start() is fire-and-forget and returns Unit; capabilities can only be attached once the session reports DeviceSessionState.STARTED.
Wearables.initialize(context)
var camera: Camera? = null
Wearables.createSession(AutoDeviceSelector()).fold(
onSuccess = { session ->
lifecycleScope.launch {
session.state.collect { state ->
if (state == DeviceSessionState.STARTED && camera == null) {
session.addCamera(StreamConfiguration()).fold(
onSuccess = { addedCamera ->
camera = addedCamera
addedCamera.stream.start().onFailure { error, _ ->
showError(error.description)
}
},
onFailure = { error, _ -> showError(error.description) },
)
}
}
}
lifecycleScope.launch {
session.errors.collect { error -> showError(error.description) }
}
session.start()
},
onFailure = { error, _ -> showError(error.description) },
)
DatResult<T, E> for typed success and failure handlingfold, onSuccess, and the two-parameter onFailure { error, cause -> } overload, which hands you the typed DatError with a descriptiongetOrElse { } receives a raw Throwable, not a typed DatError, so it cannot read error.descriptionStateFlow and FlowDeviceSession first, then attach capabilities such as Camera or Display after it reaches STARTEDlifecycleScope.launch {
Wearables.checkPermissionStatus(Permission.CAMERA)
.onSuccess { status -> /* handle status */ }
.onFailure { error, _ -> /* handle error */ }
}
Avoid getOrThrow() in user-facing samples. Surface typed errors from DatResult instead.
| Type | Purpose | Example |
|---|---|---|
DeviceSession | Device connection lifecycle | Wearables.createSession(...) |
Camera | Camera capability on a session | session.addCamera(...) |
Stream | Video stream from a camera | camera.stream |
Display | Display capability on a session | session.addDisplay(...) |
*Selector | Device targeting | AutoDeviceSelector, SpecificDeviceSelector |
*Error | Typed failure surface | DeviceSessionError, StreamError, CaptureError |
Wearables — SDK entry pointDeviceSession — lifecycle for an interaction with a linked deviceCamera — camera capability attached to a sessionStream — video stream accessed through camera.streamDisplay — display capability attached to a sessionStreamConfiguration — video quality, frame rate, and compression configurationMockDeviceKit — simulated device environment for testingIf your editor supports remote MCP servers, connect https://mcp.developer.meta.com/wearables and use search_dat_docs for current DAT setup, session lifecycle, camera streaming, MockDeviceKit, permissions, and exact API symbols. This public docs server does not require authentication; do not configure tokens, OAuth, or custom authorization headers for it.
See the dat-docs-mcp skill for client setup and troubleshooting. Use llms.txt when your tool only supports static reference context.
val mockDeviceKit = MockDeviceKit.getInstance(context)
mockDeviceKit.enable()
mockDeviceKit.pairGlasses(GlassesModel.RAYBAN_META).fold(
onSuccess = { device -> onMockDevicePaired(device) },
onFailure = { error, _ -> showError(error.description) },
)
Use MockDeviceKit to drive registration, device availability, streaming media, and permission scenarios without physical hardware.
Wearables.initialize(context)addCamera(...) or addDisplay() immediately after session.start(); wait for DeviceSessionState.STARTEDDatResult failures from createSession, addCamera, addDisplay, stream.start(), or capturePhoto; session.start() returns Unit, so watch session.errors for its failuresWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub meta/meta-wearables-dat-android --plugin mwdat-android18 skills in this plugin
/audio-streamingReceive synchronized PCM audio frames through a Camera stream on Android/camera-captureCapture standalone high-quality photos from connected glasses on Android/camera-streamingSession and Stream capability setup, video frames, photo capture, resolution and frame rate configuration/dat-docs-mcpUse the Wearables DAT MCP server for live DAT documentation search with `search_dat_docs`, Muse Code, Claude Code, Codex, Cursor, and MCP Inspector/debuggingCommon issues, Developer Mode, version compatibility, and session and stream diagnosis/display-accessDisplay capability setup, display-capable device selection, UI DSL, icons, buttons, images, and video playbackOther plugins' skills for the same job