Skip to main content
Mentra Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.To put a miniapp in front of users, host it at an HTTPS URL and share the link, or get it listed in the Mentra Miniapp Store. See Publish your miniapp.Developing on Mentra Live? We recommend using the Mentra Bluetooth SDK.The developer tools are available in the Mentra App under Settings → Miniapp Developer Settings.Share feedback with an in-app bug report, on Discord, or by email at help@mentra.glass.
session.heading reports the phone’s compass heading. Subscribe with onUpdate() to get a HeadingData every time the heading changes.
src/background/index.ts
Heading needs the LOCATION permission in your manifest, the same key session.location uses.

Continuous updates

onUpdate() delivers a HeadingData on each heading change. It returns an unsubscribe function.

HeadingData

Permission

session.heading.hasPermission is true when LOCATION is declared in your manifest. It reports the manifest declaration, not the OS grant: if the user denied the system location prompt, onUpdate() produces no reading. See Permissions.
session.heading works on both Android and iOS. It shares the LOCATION manifest key with session.location.