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.imu reports which way the wearer is looking. The glasses’ inertial
measurement unit resolves head pose into two states, "up" and "down", and
fires an event each time that state changes. Use it to wake content when someone
glances up, or to dismiss it when they look back down. session.compass reports
which way they are facing, as a magnetic heading in degrees.
This module needs the IMU hardware requirement in your
manifest. Mark it REQUIRED and
glasses without an IMU won’t list your miniapp; mark it OPTIONAL and they still
run it without head-position events. There is no runtime permission to request.
Head position
src/background/index.ts
HeadPositionData has:
Raw accelerometer
onAccel streams raw accelerometer readings, {x, y, z} in g plus a timestamp.
This is G2-only today. On glasses without an exposed IMU stream the subscription
succeeds and no events arrive.
src/background/index.ts
AccelData has:
Subscribing turns the sensor on and unsubscribing turns it off, so most callers
never touch it directly.
session.imu.setEnabled(true) drives the sensor by hand
when you want to, for instance, a diagnostic toggle. It’s a no-op on glasses
without an exposed IMU stream.
Gyroscope and raw magnetometer XYZ aren’t exposed yet.
Compass
session.compass.onUpdate() streams the glasses’ fused magnetic heading.
Subscribe like any other stream: the phone runs the sensor while at least one
miniapp is subscribed and stops it when the last one leaves.
src/background/index.ts
Each
CompassData has:
session.compass.onCalibration() fires {status: "start" | "complete"} when the
firmware recalibrates. Ask the wearer to look around until it completes.
Sampling override
session.compass.start({intervalMs, minChangeDegrees}) records the sampling
this miniapp wants. Everyone subscribed is served the smallest interval and
the smallest change threshold requested across miniapps, so one miniapp
asking for 50 ms speeds up every subscriber. stop() drops your override; live
subscriptions keep the sensor running. Both are custom firmware only.
For the phone’s own compass, see
session.phone.heading.

