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

Dat Conventions

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

Reference for Kotlin patterns, DatResult handling, module layout, and session/capability conventions when building Meta Wearables DAT SDK Android apps.

About

Documents DAT SDK Android conventions including Kotlin patterns, DatResult, the four public modules, and Gradle build commands. Android developers use it as the baseline convention reference across a DAT SDK integration.

  • Four modules: core, camera, display, mockdevice
  • Gradle build/test/install/lint quick reference

Dat Conventions 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 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/facebook/meta-wearables-dat-android --skill dat-conventions

Add your badge

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

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

What it does

Reference for Kotlin patterns, DatResult handling, module layout, and session/capability conventions when building Meta Wearables DAT SDK Android apps.

Files

SKILL.mdMarkdownGitHub ↗

DAT SDK Conventions (Android)

Quick Reference

TaskCommand
Build app./gradlew assembleDebug
Run tests./gradlew test
Install app./gradlew installDebug
Lint app./gradlew lint

Architecture

The SDK is organized into four public modules:

  • mwdat-core: Registration, permissions, devices, and session creation
  • mwdat-camera: Stream capability, video frames, and photo capture
  • mwdat-display: Display capability, display UI components, icons, images, buttons, and video
  • mwdat-mockdevice: MockDeviceKit for testing without hardware

Initialization and session setup

Wearables.initialize(context)

val session = Wearables.createSession(AutoDeviceSelector()).getOrElse { error ->
    throw IllegalStateException(error.description)
}
session.start()

val stream = session.addStream(StreamConfiguration()).getOrElse { error ->
    throw IllegalStateException(error.description)
}
stream.start().getOrElse { error ->
    throw IllegalStateException(error.description)
}

Kotlin patterns

  • Use DatResult<T, E> for typed success and failure handling
  • Observe state with StateFlow and Flow
  • Create a Session first, then attach capabilities such as Stream or Display
  • Keep frame handling off the main thread when doing heavier processing

Error handling

Wearables.checkPermissionStatus(Permission.CAMERA)
    .onSuccess { status -> /* handle status */ }
    .onFailure { error, _ -> /* handle error */ }

Avoid getOrThrow() in user-facing samples. Surface typed errors from DatResult instead.

Naming conventions

TypePurposeExample
SessionDevice connection lifecycleWearables.createSession(...)
StreamCamera capability on a sessionsession.addStream(...)
DisplayDisplay capability on a sessionsession.addDisplay(...)
*SelectorDevice targetingAutoDeviceSelector
*ErrorTyped failure surfaceSessionError, StreamError

Key types

  • Wearables — SDK entry point
  • Session — lifecycle for an interaction with a linked device
  • Stream — camera capability attached to a session
  • Display — display capability attached to a session
  • StreamConfiguration — video quality and frame rate configuration
  • MockDeviceKit — simulated device environment for testing

Live docs search

If your editor supports remote MCP servers, connect https://mcp.facebook.com/wearables_dat and use search_dat_docs for current DAT setup, session lifecycle, camera streaming, MockDeviceKit, permissions, and exact API symbols.

Use llms.txt when your tool only supports static reference context.

Testing with MockDeviceKit

val mockDeviceKit = MockDeviceKit.getInstance(context)
mockDeviceKit.enable()
val device = mockDeviceKit.pairRaybanMeta()

Use MockDeviceKit to drive registration, device availability, streaming media, and permission scenarios without physical hardware.

Common pitfalls

  • Do not call SDK APIs before Wearables.initialize(context)
  • Do not assume a session implies streaming or display access; capabilities are attached separately
  • Do not ignore DatResult failures from createSession, start, addStream, addDisplay, or capturePhoto
  • Do not reuse terminally stopped sessions

Links

Related skills

Mobile Developmentfrontendintegrations

This week in AI coding

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

unsubscribe anytime.