audio-streaming
Receive synchronized PCM audio frames through a Camera stream on Android
MockDeviceKit for testing without physical glasses hardware
Claude Code
$ npx -y skills add meta/meta-wearables-dat-android --skill mockdevice-testing --agent claude-code
Codex
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a codex -y
Cursor
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a cursor -y
Gemini CLI
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a gemini-cli -y
GitHub Copilot
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a github-copilot -y
OpenCode
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a opencode -y
Windsurf
$ npx skills add meta/meta-wearables-dat-android --skill mockdevice-testing -a windsurf -y
name: mockdevice-testing description: MockDeviceKit for testing without physical glasses hardware
Use MockDeviceKit to test DAT SDK integrations without physical Meta glasses.
MockDeviceKit simulates Meta glasses behavior for development and testing. It provides:
Add `mwdat-mockdevice` to your Gradle dependencies:
dependencies {
implementation(libs.mwdat.mockdevice)
}import com.meta.wearable.dat.mockdevice.MockDeviceKit import com.meta.wearable.dat.mockdevice.api.GlassesModel import com.meta.wearable.dat.mockdevice.api.MockDeviceKitConfig val mockDeviceKit = MockDeviceKit.getInstance(context) // Attach fake registration and connectivity (auto-initializes Wearables if needed). // By default, Wearables.registrationState transitions to Registered. mockDeviceKit.enable() // Or start in unregistered state to test registration flows: // mockDeviceKit.enable(MockDeviceKitConfig(initiallyRegistered = false)) val device = mockDeviceKit.pairGlasses(GlassesModel.RAYBAN_META).getOrThrow()
You can check `mockDeviceKit.isEnabled` to query whether the mock environment is active.
// Simulate glasses lifecycle device.powerOn() device.unfold() device.don() // Simulate wearing the glasses // Later... device.doff() // Simulate removing device.fold() device.powerOff()
MockDeviceKit provides `permissions` to control permission behavior without the Meta AI app.
By default, `RequestPermissionContract` returns `Granted`. Use `set()` to control `checkPermissionStatus()` and `setRequestResult()` to control request outcomes.
val mockDeviceKit = MockDeviceKit.getInstance(context) // Simulate denied camera permission status mockDeviceKit.permissions.set(Permission.CAMERA, PermissionStatus.Denied) // Simulate denied request result (user tapping "deny") mockDeviceKit.permissions.setRequestResult(Permission.CAMERA, PermissionStatus.Denied)
val camera = device.services.camera camera.setCameraFeed(videoUri)
val camera = device.services.camera camera.setCapturedImage(imageUri)
**Note**: Android doesn't transcode video automatically. Mock video files must be in h.265 format: the SDK requests HEVC, so MockDeviceKit rejects an h.264 file when the stream starts. Use FFmpeg to convert:
ffmpeg -i input.mp4 -c:v libx265 -tag:v hvc1 -an -vf "scale=540:960" output.mp4
On macOS, `-c:v hevc_videotoolbox` uses the hardware encoder instead.
`setCameraFeed(CameraFacing)` sources frames from the handset camera, so the app needs `android.permission.CAMERA` in the manifest and at runtime. That is not the DAT `Permission.CAMERA` covered by `MockDeviceKitConfig(initialPermissionsGranted = true)` — no real-glasses path needs the handset grant, so an existing integration will never have requested it.
Grant it before calling `setCameraFeed`; in instrumentation tests, `pm grant <your.package> android.permission.CAMERA`. Without it the mock rejects the stream start and the failure names the missing permission. `setCameraFeed(Uri)` has no such requirement.
Create a reusable test base class:
import android.content.Context
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.platform.app.InstrumentationRegistry
import com.meta.wearable.dat.mockdevice.MockDeviceKit
import com.meta.wearable.dat.mockdevice.api.MockDeviceKitConfig
import com.meta.wearable.dat.mockdevice.api.MockDeviceKitInterface
import org.junit.After
import org.junit.Before
import org.junit.Rule
open class MockDeviceKitTestCase<T : Any>(
private val activityClass: Class<T>
) {
@get:Rule
val scenarioRule = ActivityScenarioRule(activityClass)
protected lateinit var mockDeviceKit: MockDeviceKitInterface
protected lateinit var targetContext: Context
protected open val mockDeviceKitConfig = MockDeviceKitConfig()
@Before
open fun setUp() {
val instrumentation = InstrumentationRegistry.getInstrumentation()
targetContext = instrumentation.targetContext
mockDeviceKit = MockDeviceKit.getInstance(targetContext)
grantRuntimePermissions()
mockDeviceKit.enable(mockDeviceKitConfig)
}
@After
open fun tearDown() {
mockDeviceKit.disable()
}
private fun grantRuntimePermissions() {
val packageName = targetContext.packageName
val shell = InstrumentationRegistry.getInstrumentation().uiAutomation
shell.executeShellCommand("pm grant $packageName android.permission.BLUETOOTH_CONNECT")
shell.executeShellCommand("pm grant $packageName android.permission.CAMERA")
}
}To start a test in another state, override `mockDeviceKitConfig` in the subclass, for example with `MockDeviceKitConfig(initiallyRegistered = false)`. Don't call `enable` again inside the test: once the kit is enabled, further `enable` calls are ignored until `disable()`.
The CameraAccess sample app includes a Debug menu for MockDeviceKit:
1. Tap the **Debug icon** to open the MockDeviceKit menu 2. Tap **Pair RayBan Meta** to create a simulated device 3. Use **PowerOn**, **Unfold**, **Don** to simulate glasses states 4. Select video/image files for mock camera feeds 5. Start streaming to see simulated frames
| Type | Formats | |------|---------| | Video | h.265 (HEVC) | | Image | JPEG, PNG |
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…