Skip to main content

How It Works

Lifecycle Stages

1. Registration (One-Time Setup)

Register your app in the Developer Console:
  • Package Name: Unique identifier (e.g., com.example.myapp)
  • Webhook URL: Where MentraOS sends session requests
  • API Key: Secret for authentication
  • Permissions: What device data your app needs

2. Session Start

When a user starts your app:
  1. MentraOS Cloud sends HTTP POST to your webhook URL
  2. Webhook includes sessionId and userId
  3. Your server establishes WebSocket connection
  4. Your server sends connection init message
  5. Cloud confirms connection

3. Active Session

While the session is active:
  • Subscribe to events (transcription, button presses, etc.)
  • Handle incoming events with callbacks
  • Update the display using layouts
  • Access device capabilities

4. Session End

Session ends when:
  • User stops the app
  • Glasses disconnect
  • Network error occurs
  • Your server disconnects

Key Components

Important Notes

Sessions are isolated per user. Each user who starts your app gets their own AppSession instance with a unique userId.

Next Steps

Learn About AppServer

Understand the server class that powers your app

Learn About AppSession

Work with individual user sessions

Handle Events

Subscribe to real-time data from glasses

Set Permissions

Control what data your app can access

Quick Example

Here’s a minimal MentraOS app:
This app greets the user and echoes back their voice input. Simple, but it demonstrates the complete lifecycle.