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. To show that row, tap the version number at the
bottom of Settings 10 times.Share feedback with an in-app bug report, on
Discord, or by email at
help@glassly.ai.
session.permissions tells you which permissions your miniapp declared in its
miniapp.json. has(type) is a
synchronous boolean, getAll() returns the full record, and onUpdate /
onPermissionError let you react to changes and to typed permission errors.
src/background/index.ts
Methods
The Glassly App asks for every declared permission when the user launches the miniapp from the home grid or the Store, required ones first (see the manifest). Launches from the glasses or another miniapp don’t run that check, so a permission can still be ungranted when you start; treat arriving events as the signal.HEALTH works differently: the wearer allows each miniapp separately, at
launch, and the Glassly App keeps that grant itself. The wearer can turn it off
on your miniapp’s page in the Glassly App. Without that grant, session.health calls reject with
PERMISSION_DENIED and health changes never arrive. See
Health.
onUpdate does not fire with the current value when you subscribe. Call
getAll() yourself if you want the starting state. The record changes on the
connect handshake (CONNECT_ACK), or when the phone pushes an update (for
example a dev miniapp re-scanned with an updated manifest). The handler receives
the full record, not a list.
Permission types
has() and the keys of PermissionRecord use these canonical names. Each maps
from the UPPER_CASE manifest type values.
location is true if you declared either LOCATION or BACKGROUND_LOCATION, and
notifications is true if you declared either notification permission.
PermissionRecord is Record<PermissionType, boolean>, so getAll() always
returns all fifteen keys with a boolean each.
Permission errors
A request whose permission you never declared rejects withPERMISSION_NOT_DECLARED. A session.health call that you declared HEALTH
for, but that the wearer has not allowed, rejects with PERMISSION_DENIED.
A stream subscription whose permission you never declared (microphone,
transcription, translation, the wake word, location, phone heading, notifications, display
mirror, health changes) makes the host reject the whole subscription update and push the same
code to the session error event. The SDK sends every active stream in each
update, so while the undeclared stream stays subscribed, no other subscription
change takes effect: streams you add later never start, and streams that were
already running keep running. Unsubscribe from the undeclared stream, or declare
its permission. Check session.permissions.has(...) before subscribing.
onPermissionError is a filtered view of the session error event, so it fires
for rejected subscription updates and not for rejected requests.
This error means the permission is missing from your manifest, which is a fix you
make in
miniapp.json. It is separate from the user denying the OS prompt, which
produces no error and instead leaves the relevant stream silent.
This module has no
isGranted (OS-grant state) or request (prompt for a
permission) method. Treat the arrival of events as the signal that a permission
was granted.
