|
| 1 | +# MentraOS-Camera-Example-App |
| 2 | + |
| 3 | +This is a simple example app which demonstrates how to use the MentraOS Camera API to take photos and display them in a webview. |
| 4 | + |
| 5 | +You could also send the photo to an AI api, store it in a database or cloud storage, send it to Roboflow, or do other processing. |
| 6 | + |
| 7 | +### Install MentraOS on your phone |
| 8 | + |
| 9 | +MentraOS install links: [mentra.glass/install](https://mentra.glass/install) |
| 10 | + |
| 11 | +### (Easiest way to get started) Set up ngrok |
| 12 | + |
| 13 | +1. `brew install ngrok` |
| 14 | + |
| 15 | +2. Make an ngrok account |
| 16 | + |
| 17 | +3. [Use ngrok to make a static address/URL](https://dashboard.ngrok.com/) |
| 18 | + |
| 19 | +### Register your App with MentraOS |
| 20 | + |
| 21 | +1. Navigate to [console.mentra.glass](https://console.mentra.glass/) |
| 22 | + |
| 23 | +2. Click "Sign In", and log in with the same account you're using for MentraOS |
| 24 | + |
| 25 | +3. Click "Create App" |
| 26 | + |
| 27 | +4. Set a unique package name like `com.yourName.yourAppName` |
| 28 | + |
| 29 | +5. For "Public URL", enter your Ngrok's static URL |
| 30 | + |
| 31 | +6. In the edit app screen, add the microphone permission |
| 32 | + |
| 33 | +### Get your App running! |
| 34 | + |
| 35 | +1. [Install bun](https://bun.sh/docs/installation) |
| 36 | + |
| 37 | +2. Clone this repo locally: `git clone https://github.com/Mentra-Community/MentraOS-Camera-Example-App` |
| 38 | + |
| 39 | +3. cd into your repo, then type `bun install` |
| 40 | + |
| 41 | +5. Set up your environment variables: |
| 42 | + * Create a `.env` file in the root directory by copying the example: `cp .env.example .env` |
| 43 | + * Edit the `.env` file with your app details: |
| 44 | + ``` |
| 45 | + PORT=3000 |
| 46 | + PACKAGE_NAME=com.yourName.yourAppName |
| 47 | + MENTRAOS_API_KEY=your_api_key_from_console |
| 48 | + ``` |
| 49 | + * Make sure the `PACKAGE_NAME` matches what you registered in the MentraOS Console |
| 50 | + * Get your `API_KEY` from the MentraOS Developer Console |
| 51 | +
|
| 52 | +6. Run your app with `bun run dev` |
| 53 | +
|
| 54 | +7. To expose your app to the internet (and thus MentraOS) with ngrok, run: `ngrok http --url=<YOUR_NGROK_URL_HERE> 3000` |
| 55 | + * `3000` is the port. It must match what is in the app config. For example, if you entered `port: 8080`, use `8080` for ngrok instead. |
| 56 | +
|
| 57 | +
|
| 58 | +### Next Steps |
| 59 | +
|
| 60 | +Check out the full documentation at [docs.mentra.glass](https://docs.mentra.glass/camera) |
0 commit comments