Use @mentra/bluetooth-sdk from a React Native or Expo development build.
React Native apps use the JavaScript package @mentra/bluetooth-sdk. The package contains native Android and iOS code, so it must run in a development build or production native build.For a native Mac app, use the react-native-macos setup.
The phone setup below also runs on compatible Apple silicon Macs as an iOS app;
that is distinct from native macOS support.
Expo Go cannot load @mentra/bluetooth-sdk because Expo Go does not include the SDK’s native modules.
Add the SDK plugin and Android native-library packaging rules to your Expo app config. In most Expo apps this is the root app.json; in TypeScript-configured apps it is usually the root app.config.ts. Merge these keys into the existing top-level expo object instead of creating a second config file or replacing unrelated settings:
Configure permissions in the same root Expo app config. If your app already has android.permissions or ios.infoPlist, append or merge these values:
{ "expo": { "android": { "permissions": [ "android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT", "android.permission.ACCESS_FINE_LOCATION", "android.permission.RECORD_AUDIO", "android.permission.POST_NOTIFICATIONS" ] }, "ios": { "infoPlist": { "NSBluetoothAlwaysUsageDescription": "This app connects to your smart glasses over Bluetooth.", "NSMicrophoneUsageDescription": "This app uses the microphone when you enable audio features.", "NSLocalNetworkUsageDescription": "This app can connect to optional local demo servers on your network." } } }}
The SDK config plugin adds bluetooth-central to UIBackgroundModes during prebuild, merging it with any modes your app already declares. You do not need to add it yourself. It lets iOS keep delivering BLE events and reconnect to the glasses while the phone is locked, including when the glasses restart their Bluetooth chip during a software update.If the app also keeps microphone capture or an audio session active in the background, add audio yourself:
{ "expo": { "ios": { "infoPlist": { "UIBackgroundModes": [ "audio" ], "NSBluetoothAlwaysUsageDescription": "This app connects to your smart glasses over Bluetooth.", "NSMicrophoneUsageDescription": "This app uses the microphone when you enable audio features." } } }}
Configure the iOS audio session before continuous mic capture. If your app does not already depend on expo-audio, install it with bunx expo install expo-audio. Then call setAudioModeAsync once during app startup or before enabling the microphone:
Start continuous microphone capture while the app is foregrounded; iOS background mode lets an active session continue, but the SDK does not start the phone microphone from the background.Use audio background mode only when the app genuinely records or plays audio in the background. bluetooth-central is the BLE requirement; audio is the audio-session requirement for continuous mic/audio behavior.
This SDK version does not enable terminated-app Core Bluetooth state restoration with CBCentralManagerOptionRestoreIdentifierKey. If iOS terminates the app, relaunch the app and reconnect from your normal startup flow.
React Native apps can use the optional hooks subpath for common lifecycle
plumbing while keeping the root SDK available for direct commands:
Hook
Use when
useMentraBluetooth
You want one React session object for status, scan, connect/disconnect, default-device state, and gallery mode.
useBluetoothScan
You want a focused scan picker without the full connection/session helper.
useBluetoothEvent
You want React-managed subscription cleanup for hardware events such as button presses, touch, battery, Wi-Fi, hotspot, photo, stream, speaking, or microphone events.
The hooks do not request Android permissions or choose a persistence package for
you. Ask for permissions in your app before calling scan/connect actions, and
pass a defaultDeviceStorage adapter to useMentraBluetooth if you want to
restore a default device across app restarts.
Use mentra.glasses.connection.state for link-layer progress. fullyBooted only exists when state === 'connected'.Use useMentraBluetooth() as the React status API for connection, battery, Wi-Fi, hotspot, scan, and SDK runtime state. setGalleryModeEnabled(...) resolves with the ASG SettingsAckSuccessEvent and rejects failure statuses, mentra.sdk.galleryMode.enabled reflects the acknowledged gallery-mode setting, and mentra.sdk.galleryMode.applying is true while that ASG response is in flight.