audio-streaming
Receive synchronized PCM audio frames through a Camera stream on Android
SDK setup, Gradle integration, AndroidManifest configuration, and first connection to Meta glasses
Claude Code
$ npx -y skills add meta/meta-wearables-dat-android --skill getting-started --agent claude-code
Codex
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a codex -y
Cursor
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a cursor -y
Gemini CLI
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a gemini-cli -y
GitHub Copilot
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a github-copilot -y
OpenCode
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a opencode -y
Windsurf
$ npx skills add meta/meta-wearables-dat-android --skill getting-started -a windsurf -y
name: getting-started description: SDK setup, Gradle integration, AndroidManifest configuration, and first connection to Meta glasses
Set up the Meta Wearables Device Access Toolkit in an Android app.
The SDK is published to Maven Central under the `com.meta.wearable` group, so no access token or extra repository definition is required. The `mavenCentral()` repository in your `settings.gradle.kts` is all you need.
In `libs.versions.toml`:
[versions]
mwdat = "1.1.0"
[libraries]
mwdat-core = { group = "com.meta.wearable", name = "mwdat-core", version.ref = "mwdat" }
mwdat-camera = { group = "com.meta.wearable", name = "mwdat-camera", version.ref = "mwdat" }
mwdat-display = { group = "com.meta.wearable", name = "mwdat-display", version.ref = "mwdat" }
mwdat-mockdevice = { group = "com.meta.wearable", name = "mwdat-mockdevice", version.ref = "mwdat" }In `app/build.gradle.kts`:
android {
defaultConfig {
manifestPlaceholders["mwdat_application_id"] = "0"
manifestPlaceholders["mwdat_client_token"] = "0"
}
}
dependencies {
implementation(libs.mwdat.core)
implementation(libs.mwdat.camera)
implementation(libs.mwdat.display)
implementation(libs.mwdat.mockdevice)
}<manifest ...>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.INTERNET" />
<application ...>
<meta-data
android:name="com.meta.wearable.mwdat.APPLICATION_ID"
android:value="${mwdat_application_id}" />
<meta-data
android:name="com.meta.wearable.mwdat.CLIENT_TOKEN"
android:value="${mwdat_client_token}" />
<activity android:name=".MainActivity" ...>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myexampleapp" />
</intent-filter>
</activity>
</application>
</manifest>`APPLICATION_ID` and `CLIENT_TOKEN` are used for app attestation and can be found in the Wearables Developer Center. In Developer Mode, attestation is not used, so the manifest placeholders can both be `0`. For production, replace both placeholders with the credentials for your Wearables Developer Center app. Replace `myexampleapp` with your app's URL scheme.
import android.util.Log
import com.meta.wearable.dat.core.Wearables
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Wearables.initialize(this)
.onFailure { error, _ ->
Log.e("DATWearables", "Failed to initialize DAT: ${error.description}")
}
}
}Registration must complete before a session can start. Observe `Wearables.registrationState` and wait for `RegistrationState.REGISTERED`.
import android.app.Activity
import androidx.lifecycle.lifecycleScope
import com.meta.wearable.dat.core.Wearables
import com.meta.wearable.dat.core.selectors.AutoDeviceSelector
import com.meta.wearable.dat.core.session.DeviceSession
import com.meta.wearable.dat.core.session.DeviceSessionState
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
fun connect(activity: Activity) {
Wearables.startRegistration(activity)
}
fun startSession() {
Wearables.createSession(AutoDeviceSelector()).fold(
onSuccess = { session ->
lifecycleScope.launch {
session.errors.collect { error -> showError(error.description) }
}
lifecycleScope.launch {
session.state.first { state -> state == DeviceSessionState.STARTED }
addCameraStreaming(session)
}
// Fire-and-forget: returns Unit and reports failures through session.errors.
session.start()
},
onFailure = { error, _ -> showError(error.description) },
)
}Observe registration and available devices:
lifecycleScope.launch {
Wearables.registrationState.collect { state ->
// Update registration UI
}
}
lifecycleScope.launch {
Wearables.devices.collect { devices ->
// Update the device list
}
}Call this only once the session reports `DeviceSessionState.STARTED`; adding a capability earlier fails with `DeviceSessionError.SESSION_IDLE`.
import com.meta.wearable.dat.camera.addCamera
import com.meta.wearable.dat.camera.types.StreamConfiguration
import com.meta.wearable.dat.camera.types.VideoQuality
fun addCameraStreaming(session: DeviceSession) {
session.addCamera(
StreamConfiguration(videoQuality = VideoQuality.MEDIUM, frameRate = 24),
).fold(
onSuccess = { camera ->
camera.stream.start().onFailure { error, _ -> showError(error.description) }
},
onFailure = { error, _ -> showError(error.description) },
)
}Camera access also needs the DAT camera permission; see the `permissions-registration` skill.
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…