Skip to content
Mobile
Skill

/mockdevice-testing

MockDeviceKit for testing without physical glasses hardware

BOOST
From plugin
meta-wearables-dat-android
38117 skills
Install
$ npx -y skills add facebook/meta-wearables-dat-android --skill mockdevice-testing --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/mockdevice-testing

Context preview

The summary Claude sees to decide when to auto-load this skill.

MockDeviceKit for testing without physical glasses hardware

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.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. Use FFmpeg to convert:

ffmpeg -hwaccel videotoolbox -i input.mp4 -c:v hevc_videotoolbox -c:a aac_at -tag:v hvc1 -vf "scale=540:960" output.mov

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

    @Before
    open fun setUp() {
        val instrumentation = InstrumentationRegistry.getInstrumentation()
        targetContext = instrumentation.targetContext
        mockDeviceKit = MockDeviceKit.getInstance(targetContext)
        grantRuntimePermissions()
    }

    @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")
    }
}

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.264 (AVC), h.265 (HEVC) | | Image | JPEG, PNG |

Links

  • [Mock Device Kit overview](https://wearables.developer.meta.com/docs/mock-device-kit)
  • [Android testing guide](https://wearables.developer.meta.com/docs/testing-mdk-android)
Read more
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.

Get the whole plugin