### Install Flutter Dependencies Source: https://docs.omi.me/doc/developer/AppSetup These commands navigate to the 'app' directory and then execute 'flutter pub get' to download and install all the necessary Dart and Flutter packages specified in your project's pubspec.yaml file. This is a fundamental step after cloning a Flutter project or making changes to dependencies. ```shell cd app flutter pub get ``` -------------------------------- ### Verify Flutter Installation and Setup Source: https://docs.omi.me/doc/developer/AppSetup This command checks your Flutter installation and environment, identifying any missing dependencies or configuration issues required for Flutter development. It provides detailed output about your SDKs, connected devices, and editor integrations. ```shell flutter doctor -v ``` -------------------------------- ### Install Python and Dependencies using Package Managers Source: https://docs.omi.me/doc/developer/backend/Backend_Setup This section provides commands for installing Python and other essential development tools like Git and FFmpeg using common package managers such as Homebrew (Mac), Nix Envdir, and Chocolatey (Windows). It also includes instructions for installing Python packages like PyOgg and all project requirements from a `requirements.txt` file. ```bash brew install python choco install python brew install git ffmpeg choco install git.install ffmpeg brew install opus pip install PyOgg pip install -r requirements.txt ``` -------------------------------- ### Configure and Run Pusher Service Source: https://docs.omi.me/doc/developer/backend/Backend_Setup This section details the optional setup for the Pusher service, which is required for the webhooks feature. It includes commands to navigate to the Pusher directory, create and populate the `.env` file with Google Cloud credentials, and start the Pusher service using `uvicorn`. ```bash cd pusher cp .env.template .env # Set the SERVICE_ACCOUNT_JSON environment variable in .env uvicorn pusher.main:app --reload --env-file .env --port 8000 ``` -------------------------------- ### Install Google Cloud SDK for Windows Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Installs the Google Cloud SDK using Chocolatey on Windows systems. This SDK is required for managing Google Cloud resources and authentication locally. ```powershell choco install gcloudsdk ``` -------------------------------- ### Install Google Cloud SDK for macOS/Linux Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Installs the Google Cloud SDK using Homebrew on macOS or Linux systems. This SDK is essential for interacting with Google Cloud services from your local environment. ```bash brew install google-cloud-sdk ``` -------------------------------- ### Install Pre-commit Hook for Code Formatting Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Installs a pre-commit hook to automatically format code before each commit. This ensures consistent code style across the project. ```bash # From the root of the repository ln -s -f ../../scripts/pre-commit .git/hooks/pre-commit ``` -------------------------------- ### Build Omi App for iOS - Bash Source: https://docs.omi.me/doc/developer/AppSetup Executes the setup script to build the Omi application for the iOS platform. This is primarily for iOS simulators. ```bash setup.sh ios ``` -------------------------------- ### Run Backend Server with Uvicorn Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Starts the backend server using Uvicorn. The `--reload` flag enables automatic server restarts on code changes, `--env-file .env` loads environment variables, and `--port 8000` sets the listening port. ```bash uvicorn main:app --reload --env-file .env --host 0.0.0.0 --port 8000 ``` -------------------------------- ### Install Python Dependencies using Pip Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Installs Python project dependencies from a requirements file. It can be used within a virtual environment for isolation or directly, though direct installation might cause conflicts with other projects. ```bash pip install -r requirements.txt ``` ```bash pip install -r requirements.txt --upgrade --force-reinstall ``` -------------------------------- ### Install NPM Dependencies for Example App Source: https://docs.omi.me/doc/developer/sdk/ReactNative Installs npm dependencies specifically for the example application within the Omi React Native SDK. This is required to run and test the SDK's functionality. ```bash cd example npm install ``` -------------------------------- ### Build Omi App for Android - Bash Source: https://docs.omi.me/doc/developer/AppSetup Executes the setup script to build the Omi application for the Android platform. This command prepares the app for Android devices. ```bash setup.sh android ``` -------------------------------- ### Install iOS CocoaPods Dependencies Source: https://docs.omi.me/doc/developer/AppSetup These commands navigate to the 'ios' directory and then install the native iOS dependencies using CocoaPods. 'pod install' fetches and links the required libraries for your iOS app, while 'pod repo update' ensures you have the latest specification versions for all pods. ```shell cd ios pod install pod repo update ``` -------------------------------- ### Build Omi App for macOS - Bash Source: https://docs.omi.me/doc/developer/AppSetup Executes the setup script to build the Omi application for the macOS platform. Requires device ID registration for provisioning. ```bash setup.sh macos ``` -------------------------------- ### Navigate to App Directory - Bash Source: https://docs.omi.me/doc/developer/AppSetup Changes the current directory to the 'app' folder, a common first step before executing build or setup scripts. ```bash cd app ``` -------------------------------- ### Setup Omi App on Windows - PowerShell Source: https://docs.omi.me/doc/developer/AppSetup Runs the setup script for the Omi application on a Windows environment using PowerShell. This script handles environment configuration for Windows. ```powershell .\setup\scripts\setup.ps1 ``` -------------------------------- ### Install Pre-commit Hook for Code Formatting Source: https://docs.omi.me/doc/developer/AppSetup This command sets up a pre-commit hook to automatically format your code using `dart format` before each commit. It ensures code consistency across the project by linking the `pre-commit` script from the `scripts` directory to the `.git/hooks` directory. ```bash ln -s -f ../../scripts/pre-commit .git/hooks/pre-commit ``` -------------------------------- ### Run Omi App in Simulator - Flutter CLI Source: https://docs.omi.me/doc/developer/AppSetup Starts the Omi application in a simulator using the Flutter command-line interface with the 'dev' flavor. This command assumes the app has already been built. ```bash flutter run --flavor dev ``` -------------------------------- ### Set up Environment File (.env) Source: https://docs.omi.me/doc/developer/backend/Backend_Setup This snippet shows how to create and populate the `.env` file, which is crucial for configuring various API keys and credentials for services like OpenAI, Deepgram, Redis, Modal, and OAuth providers (Google, Apple). It also includes placeholders for admin keys and encryption secrets. ```bash cp .env.template .env # Fill in the .env file with the following: # OPENAI_API_KEY=... # DEEPGRAM_API_KEY=... # Redis Credentials: Host, port, username, password # Modal API Key: ... # ADMIN_KEY=123 # ENCRYPTION_SECRET=... # GOOGLE_CLIENT_ID=... # GOOGLE_CLIENT_SECRET=... # APPLE_CLIENT_ID=... # APPLE_TEAM_ID=... # APPLE_KEY_ID=... # APPLE_PRIVATE_KEY=... # HOSTED_PUSHER_API_URL=... # Typesense Credentials: Host, port, API key ``` -------------------------------- ### Omi Python SDK Local Development Setup Source: https://docs.omi.me/doc/developer/sdk/python Sets up a local development environment for the Omi Python SDK. This involves cloning the repository, creating a virtual environment, and installing the SDK in editable mode along with development dependencies. ```bash git clone https://github.com/BasedHardware/omi.git cd omi/sdks/python # Create virtual environment python3 -m venv venv source venv/bin/activate # Install in editable mode pip install -e . # Install dev dependencies pip install -e ".[dev]" ``` -------------------------------- ### Create and Activate Python Virtual Environment Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Creates and activates a Python virtual environment named 'venv'. This isolates project dependencies. The activation command differs between Windows and macOS/Linux. ```bash # Create a new virtual environment python -m venv venv # Activate the virtual environment # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate ``` -------------------------------- ### Build Development APK Source: https://docs.omi.me/doc/developer/AppSetup This command builds an Android APK specifically for the development flavor. This is useful for testing the development build on an Android device or emulator. ```bash flutter build apk --flavor dev ``` -------------------------------- ### Clone Omi Backend Repository using Git Source: https://docs.omi.me/doc/developer/backend/Backend_Setup This snippet demonstrates how to clone the Omi backend repository from GitHub using Git. It involves navigating to the desired directory, cloning the repository, and then changing into the backend subdirectory. ```bash git clone https://github.com/BasedHardware/Omi.git cd Omi cd backend ``` -------------------------------- ### Install Omi Python SDK from PyPI Source: https://docs.omi.me/doc/developer/sdk/python Installs the Omi Python SDK from the Python Package Index (PyPI). This is the recommended installation method when the package is published. ```bash pip install omi-sdk ``` -------------------------------- ### Authenticate with Google Cloud Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Authenticates the user with Google Cloud and sets the default project. This process generates application default credentials necessary for programmatic access to Google Cloud services, particularly useful for Python applications. ```bash gcloud auth login gcloud config set project gcloud auth application-default login --project ``` -------------------------------- ### Configure Firebase Options for Development Source: https://docs.omi.me/doc/developer/AppSetup This command configures Firebase options for the development environment. It generates `firebase_options_dev.dart`, specifies development-specific iOS and macOS bundle IDs, and directs output to development-specific directories. Use this for your local development setup. ```bash flutterfire config --out=lib/firebase_options_dev.dart --ios-bundle-id=com.friend-app-with-wearable.ios12.development --android-app-id=com.friend.ios.dev --android-out=android/app/src/dev/ --ios-out=ios/Config/Dev/ --macos-bundle-id=com.friend-app-with-wearable.ios12.development --macos-out=macos/Config/Prod ``` -------------------------------- ### Install Omi Python SDK from Source Source: https://docs.omi.me/doc/developer/sdk/python Installs the Omi Python SDK from its source code repository. This involves cloning the repository and then performing an editable installation. ```bash git clone https://github.com/BasedHardware/omi.git cd omi/sdks/python pip install -e . ``` -------------------------------- ### Create Ngrok HTTP Tunnel Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Creates an HTTP tunnel using Ngrok to expose a local server running on a specified port (e.g., 8000) to the internet. This is useful for local development and testing with external services. ```bash ngrok http --domain=example.ngrok-free.app 8000 ``` -------------------------------- ### Create Development Environment File Source: https://docs.omi.me/doc/developer/AppSetup This command copies the template environment file '.env.template' to '.dev.env', creating a new file for local development environment variables. This is a common practice to manage API keys and other configuration settings separately from the codebase. ```shell cd .. cat .env.template > .dev.env ``` -------------------------------- ### Run Flutter App with Development Flavor Source: https://docs.omi.me/doc/developer/AppSetup This command runs the Flutter application with the development flavor enabled. The `-v` flag enables verbose logging, which can be helpful for debugging. Ensure your target device is selected in Xcode or Android Studio before running. ```bash flutter run -v --flavor dev ``` -------------------------------- ### Basic Omi React Native SDK Usage Example Source: https://docs.omi.me/doc/developer/sdk/ReactNative Demonstrates the basic usage of the OmiConnection class in React Native. It covers scanning for devices, connecting, getting audio codec, streaming audio, monitoring battery, and disconnecting. ```javascript import { OmiConnection, DeviceConnectionState, BleAudioCodec } from '@omiai/omi-react-native'; // Create an instance of OmiConnection const omiConnection = new OmiConnection(); // Scan for devices const stopScan = omiConnection.scanForDevices((device) => { console.log('Found device:', device.name, device.id); }, 10000); // Scan for 10 seconds // Connect to a device async function connectToDevice(deviceId) { const success = await omiConnection.connect(deviceId, (id, state) => { console.log(`Device ${id} connection state changed to: ${state}`); }); if (success) { console.log('Connected successfully!'); // Get the audio codec const codec = await omiConnection.getAudioCodec(); console.log('Device audio codec:', codec); // Start listening for audio data const subscription = await omiConnection.startAudioBytesListener((bytes) => { console.log('Received audio bytes:', bytes.length); // Process audio bytes here }); // Get battery level const batteryLevel = await omiConnection.getBatteryLevel(); console.log('Battery level:', batteryLevel); // Later, stop listening for audio await omiConnection.stopAudioBytesListener(subscription); // Disconnect when done await omiConnection.disconnect(); } } ``` -------------------------------- ### Copy Google Cloud Credentials (Windows) Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Copies the generated Google Cloud application default credentials file to the backend directory and renames it to 'google-credentials.json' on Windows systems. This file is crucial for authentication in backend services. ```cmd copy %APPDATA%\gcloud\application_default_credentials.json google-credentials.json ``` -------------------------------- ### Configure Firebase Options for Production Source: https://docs.omi.me/doc/developer/AppSetup This command configures Firebase options for the production environment. It generates `firebase_options_prod.dart`, specifies iOS and macOS bundle IDs, and directs output to specific directories for Android and iOS configurations. Ensure you substitute your actual Apple identifiers. ```bash flutterfire config --out=lib/firebase_options_prod.dart --ios-bundle-id=IOS_BUNDLE_ID --android-app-id=com.friend.ios --android-out=android/app/src/prod/ --ios-out=ios/Config/Prod/ --macos-bundle-id=MACOS_BUNDLE_ID --macos-out=macos/Config/Prod ``` -------------------------------- ### Clean and Build with build_runner Source: https://docs.omi.me/doc/developer/AppSetup These Dart commands are used to manage code generation for Dart projects, particularly those using code generation packages like `build_runner`. 'clean' removes previously generated files, and 'build' regenerates all necessary files based on your project's annotations and configurations. ```dart dart pub run build_runner clean dart pub run build_runner build ``` -------------------------------- ### Format Code with Black Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Installs the 'black' Python code formatter. This tool is used to maintain code quality and consistency, enforcing a line length of 120 characters. ```bash pip install black ``` -------------------------------- ### Configure Flutter to Use Specific JDK Path Source: https://docs.omi.me/doc/developer/AppSetup This command allows you to explicitly set the Java Development Kit (JDK) path for Flutter, which is crucial for Android builds if you have multiple JDK versions installed or need to use a specific version like JDK 21. This ensures that Flutter uses the correct JDK for compilation. ```shell flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home ``` -------------------------------- ### Run Omi SDK Example Script Source: https://docs.omi.me/doc/developer/sdk/python Instructions to run the Omi Python SDK example script. This involves setting the Deepgram API key, finding the Omi device MAC address, updating the script with the MAC address, and then executing the script. ```bash # 1. Set your Deepgram API key export DEEPGRAM_API_KEY=your_actual_deepgram_key # 2. Find your Omi device MAC address ami-scan # 3. Update examples/main.py with your device's MAC address # Edit line 10: OMI_MAC = "YOUR_DEVICE_MAC_HERE" # 4. Run the example python examples/main.py ``` -------------------------------- ### Install CocoaPods Dependencies for iOS Source: https://docs.omi.me/doc/developer/sdk/ReactNative Installs CocoaPods dependencies for the iOS version of the Omi React Native SDK example app. This step is crucial for native module integration on iOS. ```bash cd ios pod install ``` -------------------------------- ### Deactivate Python Virtual Environment Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Deactivates the currently active Python virtual environment, returning the user to their system's global Python environment. ```bash deactivate ``` -------------------------------- ### Start omiGlass Application (npm/yarn) Source: https://docs.omi.me/doc/hardware/omiGlass Launches the omiGlass application using either npm or yarn. The application is built with Expo and provides a localhost link to access the web version. ```bash npm start ``` ```bash yarn start ``` -------------------------------- ### Troubleshoot SSL Errors in Python Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Temporarily bypasses SSL certificate verification for HTTPS requests in Python. This is a workaround for SSL errors encountered during operations like model downloads. ```python import ssl ssl._create_default_https_context = ssl._create_unverified_context ``` -------------------------------- ### Copy Google Cloud Credentials (macOS/Linux) Source: https://docs.omi.me/doc/developer/backend/Backend_Setup Copies the generated Google Cloud application default credentials file to the backend directory and renames it to 'google-credentials.json'. This file is used for authentication in backend applications. ```bash cp ~/.config/gcloud/application_default_credentials.json ./google-credentials.json ``` -------------------------------- ### Read Conversations using cURL Source: https://docs.omi.me/doc/developer/apps/Import Executes a GET request to the Omi.me API to retrieve conversations for a specific user. This command-line example demonstrates how to include authentication, content type, and query parameters for fetching conversation data. ```bash curl -X GET "https://api.omi.me/v2/integrations/your_app_id_here/conversations?uid=user_123&limit=50&offset=0" \ -H "Authorization: Bearer sk_your_api_key_here" \ -H "Content-Type: application/json" ``` -------------------------------- ### Run Android Example App Source: https://docs.omi.me/doc/developer/sdk/ReactNative Builds and runs the Omi React Native SDK example app on an Android device. Requires the device to be connected via USB with debugging enabled. ```bash cd example npm run android ``` -------------------------------- ### Open Xcode Workspace for iOS Example App Source: https://docs.omi.me/doc/developer/sdk/ReactNative Opens the Xcode workspace for the Omi SDK example application on iOS. It's important to open the .xcworkspace file, not the .xcodeproj file, to ensure proper native module loading. ```bash cd example/ios open OmiSDKExample.xcworkspace ```