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.system runs OS-level actions on the phone: open the native share sheet, save a file through the system downloader, copy text to the clipboard, or open a URL in the phone browser. None of these need a permission or any hardware.
src/background/index.ts

Share

share(options) opens the phone’s native share sheet. Pass text and a URL for a link share, or pass base64 with a mimeType to share file contents. The promise resolves once the sheet closes.

Download

download(options) saves a file. It opens the share sheet so the user picks where to save. Give it a url to fetch from, or base64 data you already have.
To export data your miniapp holds as binary, read it from session.blob, base64-encode it, and pass it to share or download.

Clipboard

copyToClipboard(text) copies a string to the system clipboard. It resolves when the copy is done.

Open URL

openUrl(url) opens a URL in the phone’s browser. It’s fire-and-forget: it returns void immediately and doesn’t report whether the browser opened. Dangerous schemes (javascript:, file:) are blocked.

Getting a result back

openUrl has no return channel. A page that needs to hand something back, such as the redirect that ends a third-party sign-in, opens com.glassly://applet/link/<packageName>?key=value. The Glassly App opens that miniapp, starting it if needed, and passes the query parameters to session.onLink:
Any app or web page can open such a link, so treat params as untrusted: check a state value you generated before acting on the rest. A link that arrives before your first onLink handler is registered is replayed to it. onLink returns an unsubscribe function.

Scan a QR code

scanQr(options) opens the phone camera as a QR scanner overlay. It doesn’t unmount your miniapp, so a live session keeps running underneath. It resolves with the raw QR payload, or {cancelled: true} if the user dismisses the scanner.

Exit

exit() asks the host to stop your miniapp. It’s fire-and-forget, use it after finishing one-shot work, for example an action handler that woke your miniapp headlessly and has nothing more to do. Return the action’s result first since the call tears the JS context down shortly after the host accepts.