Skip to content
Mobile
Skill

/mockdevice-testing

MockDeviceKit for testing without physical glasses hardware

From plugin
meta-wearables-dat-android
40718 skills

Claude Code

$ npx -y skills add meta/meta-wearables-dat-android --skill mockdevice-testing --agent claude-code

SKILL.md

mockdevice-testing.SKILL.md
name: mockdevice-testing
description: MockDeviceKit for testing without physical glasses hardware

MockDevice Testing (Android)

Use MockDeviceKit to test DAT SDK integrations without physical Meta glasses.

MockDeviceKit simulates Meta glasses behavior for development and testing. It provides:

  • `MockDeviceKit` — Entry point for creating simulated devices
  • `MockGlasses` — Simulated Ray-Ban Meta glasses
  • `MockCameraKit` — Simulated camera with configurable video feed and photo capture

Setup

Add `mwdat-mockdevice` to your Gradle dependencies:

dependencies {
    implementation(libs.mwdat.mockdevice)
}

Creating a mock device

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.

Simulating device states

// Simulate glasses lifecycle
device.powerOn()
device.unfold()
device.don()    // Simulate wearing the glasses

// Later...
device.doff()   // Simulate removing
device.fold()
device.powerOff()

Configuring permissions

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)

Setting up mock camera feeds

Video streaming

val camera = device.services.camera
camera.setCameraFeed(videoUri)

Photo capture

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.

Phone camera as the feed

`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.

Writing instrumentation tests

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()`.

Using MockDeviceKit in the CameraAccess sample

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

Supported media formats

| Type | Formats | |------|---------| | Video | h.265 (HEVC) | | Image | JPEG, PNG |

Links

  • [Mock Device Kit overview](https://wearables.developer.meta.com/docs/mock-device-kit)
  • [Android tes
Read more
@facebook
Ships withmeta-wearables-dat-android

The Meta Wearables Device Access Toolkit enables developers to utilize Meta's AI glasses to build hands-free wearable experiences into their mobile applications.

Stars on GitHub

Momentum

stars in total
407
Star history of facebook/meta-wearables-dat-android on GitHub, a chart by star-history.com

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo12d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens4w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about mockdevice-testing.

Which coding agents can use mockdevice-testing?
mockdevice-testing installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.