Native Android reference app for the Mentra Bluetooth SDK, built with Kotlin and Jetpack Compose.
This example installs the SDK as com.mentra:bluetooth-sdk and is intended to run from a fresh clone once the Mentra Maven package is available. No path to a local MentraOS checkout is required for normal SDK use.
- Android Studio Hedgehog or newer, or Gradle from the command line.
- Java 17.
- Android SDK with API 35+ installed.
- A physical Android phone for Bluetooth, camera, microphone, direct phone photo, and direct phone WebRTC testing.
- Mentra smart glasses with Bluetooth enabled.
The example reads the SDK version from gradle.properties:
mentraSdkVersion=0.1.1Use the latest SDK version published by Mentra. If a dedicated Mentra Maven repository is required, add it to settings.gradle.kts beside google() and mavenCentral().
- Open this
examples/androidfolder in Android Studio. - Let Gradle sync and install any missing Android SDK packages.
- Select a physical Android phone.
- Run the
appconfiguration.
cd examples/android
./gradlew installDebugThe first build downloads the official GStreamer Android SDK when it is not already present under .gstreamer/Android.sdk. The archive is checksum-verified and not committed. To use an existing install, set one of:
export GSTREAMER_ROOT_ANDROID=/path/to/Android.sdk
./gradlew installDebug./gradlew installDebug -PgstreamerRootAndroid=/path/to/Android.sdkUse this only when developing the SDK before a Maven release is published:
cd /path/to/MentraOS/mobile/android
./gradlew :lc3Lib:publishToMavenLocal :mentra-bluetooth-sdk:publishToMavenLocal
cd /path/to/mentra-bluetooth-sdk-starter-kit/examples/android
./gradlew installDebugsettings.gradle.kts already includes mavenLocal() so the local artifact overrides the published version when the version numbers match.
The example has five tabs:
- Device: scan for Mentra Live glasses, connect, disconnect, reconnect to the saved/default device, and inspect battery, firmware, Wi-Fi, RSSI, and discovered-device state.
- Camera: request photo upload to the local demo cloud or directly to this phone, then preview the received JPEG.
- Stream: start RTMP, SRT, or WebRTC streams, send 15-second keep-alives, and preview HLS/WebRTC output. WebRTC can be received directly on the phone through the app-hosted GStreamer WHIP receiver.
- System: scan/connect/forget Wi-Fi, toggle hotspot, change save-in-gallery mode, receive microphone PCM, and send RGB LED controls.
- Console: watch button, touch, swipe, BLE, TX, STORE, hotspot, stream, photo, microphone, and raw SDK events.
From the repo root:
python3 examples/local-demo-cloud/server.pyPaste the printed LAN /upload URL into the Camera screen. Paste the printed RTMP, SRT, or WHIP publish URL into the Stream screen. If Docker is not installed or not running, the helper still starts the photo webhook and skips streaming with a warning.
Do not use localhost in the app. The glasses, phone, and computer must be on a network where the glasses can reach the printed LAN address.
Direct phone photo and WebRTC require real hardware:
- Use a physical Android phone. The direct WebRTC native bridge is built for
arm64-v8a. - Connect Mentra Live through the SDK before capture or streaming.
- Keep the glasses Wi-Fi active.
- Keep the phone and glasses on a reachable local network.
- If the app cannot find a phone LAN IP, connect the phone to Wi-Fi or another network the glasses can reach.
adb -s <phone-serial> logcat -v threadtime | rg -i "Mentra|GStreamer|GST|WHIP|webrtc|photo|upload|SDK|error"
adb -s <glasses-serial> logcat -v threadtime | rg -i "WhipStreamingService|WHIP|stream_status|PeerConnection|photo|upload|error"app/src/main/java/com/mentra/examples/android/MentraExampleController.kt: SDK integration and screen state.app/src/main/java/com/mentra/examples/android/MainActivity.kt: entry point and permission prompts.app/src/main/java/com/mentra/examples/android/screens/: Compose screens for the five tabs.app/src/main/java/com/mentra/examples/android/media/: direct phone photo and WebRTC receivers.app/build.gradle.kts: SDK, Compose, Media3, Coil, GStreamer, and coroutine dependencies.settings.gradle.kts: Maven repositories, includingmavenLocal()for SDK development.