audio-streaming
Receive synchronized PCM audio frames through a Camera stream on Android
Building a complete DAT app with session creation, camera streaming, and photo capture
Claude Code
$ npx -y skills add meta/meta-wearables-dat-android --skill sample-app-guide --agent claude-code
Codex
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a codex -y
Cursor
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a cursor -y
Gemini CLI
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a gemini-cli -y
GitHub Copilot
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a github-copilot -y
OpenCode
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a opencode -y
Windsurf
$ npx skills add meta/meta-wearables-dat-android --skill sample-app-guide -a windsurf -y
name: sample-app-guide description: Building a complete DAT app with session creation, camera streaming, and photo capture
Build an Android DAT app with registration, sessions, camera streaming, and photo capture.
Pair this with the [CameraAccess sample](https://github.com/meta/meta-wearables-dat-android/tree/main/samples).
1. Create an Android Studio app project. 2. Declare the SDK dependencies in `libs.versions.toml` and your app's `build.gradle.kts`. 3. Configure `AndroidManifest.xml` for registration callbacks plus `APPLICATION_ID` and `CLIENT_TOKEN`. 4. Initialize `Wearables` in your `Application`.
app/src/main/java/com/example/myapp/
├── MyApplication.kt
├── MainActivity.kt
├── session/
│ └── SessionViewModel.kt
└── ui/
├── RegistrationScreen.kt
└── CameraScreen.ktclass MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleScope.launch {
Wearables.registrationState.collect { state ->
// Update registration UI
}
}
}
fun register() {
Wearables.startRegistration(this)
}
}`DeviceSession.start()` is fire-and-forget. Attach the camera from the session-state collector once the session reports `DeviceSessionState.STARTED`; adding a capability to an `IDLE` session fails with `DeviceSessionError.SESSION_IDLE`.
class SessionViewModel : ViewModel() {
private var session: DeviceSession? = null
private var camera: Camera? = null
fun startCameraSession() {
Wearables.createSession(AutoDeviceSelector()).fold(
onSuccess = { createdSession ->
session = createdSession
viewModelScope.launch {
createdSession.errors.collect { error -> showError(error.description) }
}
viewModelScope.launch {
createdSession.state.collect { state ->
when (state) {
DeviceSessionState.STARTED -> attachCamera(createdSession)
DeviceSessionState.STOPPED -> clearSession(createdSession)
else -> Unit
}
}
}
createdSession.start()
},
onFailure = { error, _ -> showError(error.description) },
)
}
private fun attachCamera(activeSession: DeviceSession) {
if (camera != null) return
activeSession.addCamera(
StreamConfiguration(videoQuality = VideoQuality.MEDIUM, frameRate = 24),
).fold(
onSuccess = { addedCamera ->
camera = addedCamera
viewModelScope.launch {
addedCamera.stream.videoStream.collect { frame ->
// Render preview
}
}
addedCamera.stream.start().onFailure { error, _ ->
showError(error.description)
}
},
onFailure = { error, _ -> showError(error.description) },
)
}
private fun clearSession(stoppedSession: DeviceSession) {
if (session !== stoppedSession) return
camera = null
session = null
}
}fun capturePhoto() {
viewModelScope.launch {
camera?.stream?.capturePhoto()
?.onSuccess { photoData ->
when (photoData) {
is PhotoData.Bitmap -> savePhoto(photoData.bitmap)
is PhotoData.HEIC -> saveHeic(photoData.data)
}
}
?.onFailure { error, _ ->
showCaptureError(error.description)
}
}
}fun stopCameraSession() {
camera?.stop()
session?.stop()
camera = null
session = null
}Use `MockDeviceKit` to simulate linking glasses, permission state, and camera media without physical hardware. See the `mockdevice-testing` skill for setup details.
The Meta Wearables Device Access Toolkit enables developers to utilize Meta's AI glasses to build hands-free wearable experiences into their mobile applications.
Receive synchronized PCM audio frames through a Camera stream on Android
Capture standalone high-quality photos from connected glasses on Android
Session and Stream capability setup, video frames, photo capture, resolution and frame rate configuration
Kotlin patterns, DatResult, session and capability conventions for DAT SDK Android development
Use the Wearables DAT MCP server for live DAT documentation search with `search_dat_docs`, Muse Code, Claude Code, Codex, Cursor,…
Decompile Android APK, XAPK, JAR, and AAR files using jadx or Fernflower/Vineflower. Reverse engineer Android apps, extract HTTP…