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.
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, magnetometer, and fused orientation aren’t exposed yet.

