Glassly Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.Developing on Mentra Live? We recommend using the Glassly Bluetooth SDK.The developer tools are available in the Glassly App under Settings → Miniapp Developer Settings.Share feedback with an in-app bug report, on Discord, or by email at [email protected].
session.lightSensor reads the ambient light sensor on the glasses. It needs G2 custom firmware (Glassly CFW or upstream g2flash); stock firmware and other glasses reject its control requests.
src/background/index.ts
Subscribing only delivers events. Polling starts and stops explicitly, and unsubscribing alone leaves the hardware running until stop() or the miniapp closes.

Reading light

query() asks for the driver’s cached value without opening the sensor. The answer arrives through onUpdate() with reason: "query" and may be stale. start(options?) polls the sensor and, while polling, pauses the stock automatic brightness adjustments. Calling it again re-applies new options. stop() restores stock behavior without changing the brightness setting. Each LightSensorData has:

Ownership

One miniapp controls the sensor at a time. Others can observe readings but cannot reconfigure or stop it; their start() and stop() reject with INVALID_ARGUMENT. Closing the owning miniapp releases the sensor. A session.navigation trip on the glasses temporarily takes the sensor back and polling resumes afterward. Polling is bound to the custom firmware’s display lease: opening a stock screen on the glasses or letting the miniapp display go idle stops polling. Call start() again when your content returns.
Successful delivery of a command is not proof of a fresh sample. start() rejects with INTERNAL when the firmware refuses or never acknowledges it, for example on stock firmware or without an active miniapp display.

Cleaning up