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.phone reports state from the user’s phone: notifications as they post, calendar events, the phone’s compass heading, and the phone’s own battery. Each concern is its own sub-module. Register a handler and the events start arriving.
src/background/index.ts
Reading notifications needs the READ_NOTIFICATIONS permission, posting them needs POST_NOTIFICATIONS, calendar events need CALENDAR, and the phone heading needs LOCATION, all declared in your manifest. Phone battery needs no permission.

Notifications

session.phone.notifications.on() fires when a notification posts on the phone, or when a miniapp posts one (see Posting notifications).
Each event is a PhoneNotificationData:

Dismissals

session.phone.notifications.onDismissed() fires when the user swipes away or clears a notification, and when a miniapp dismisses one it posted.
Each event is a NotificationDismissedData:
Phone dismissals are Android only. iOS does not expose dismiss callbacks to apps (an Apple privacy restriction), so on iOS only miniapp dismissals arrive. The matching notifications.on() post-event works on both platforms.

Posting notifications

session.phone.notifications.post() sends a notification down the same path the phone’s own notifications take. The dashboard shows it in its viewer and pops it up like any other, every miniapp reading notifications receives it with system: false and source set to your package, and on glasses without the dashboard view it reaches the wearer the way a phone notification would (the glasses’ own notification centre where the phone uploads to it, or the host’s card and speech). Declare POST_NOTIFICATIONS.
post() resolves with the id. Readers see notificationId as <your package>:<id>, so ids never collide with another miniapp’s. The notification carries your miniapp’s name as app, and the wearer’s per-app notification filter lists your miniapp and can block it. Nothing is posted to the phone’s own notification shade.

Calendar

session.phone.calendar.listEvents() reads a current snapshot from all event calendars on the phone. Declare CALENDAR as a required permission; the Glassly App requests access before opening the miniapp.
The date window may span at most 31 days. limit defaults to 50 and may not exceed 100. The result contains events and a truncated flag. Each event has:

Phone heading

session.phone.heading.onUpdate() streams the phone’s compass heading on both Android and iOS. The phone compass starts on the first subscriber and stops on the last. For the heading of the glasses themselves, use session.compass.
Each event is a HeadingData: session.phone.heading.hasPermission is true when LOCATION is declared in your manifest, the same key session.location uses. It reports the declaration, not the OS grant.

Phone battery

session.phone.onBattery() reports the phone’s battery. It stays flat (not sub-namespaced) because it’s a single event.
Each event is a BatteryData:

Cleaning up

Every subscription returns an unsubscribe function. The notifications sub-module also has a stop() that tears down every notification subscription at once. Calendar snapshots do not create a subscription.
session.phone.notifications.hasPermission tells you whether READ_NOTIFICATIONS is declared in your manifest, and session.phone.calendar.hasPermission tells you whether CALENDAR is declared. Neither tells you whether the user granted the OS prompt. A calendar request rejects with PERMISSION_DENIED if access was later revoked. See Permissions.