The Rokid Feature Demo is a reference Android app for Rokid Glasses that exercises the core device features you’ll reach for in nearly every real app. It covers touchpad and voice-command navigation, live camera preview, microphone level metering, and audio playback — all using reusableDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/RealComputer/GlassKit/llms.txt
Use this file to discover all available pages before exploring further.
ScreenController components you can copy directly. When physical glasses are unavailable, the app runs on a standard Android phone or an AVD emulator with a touchscreen fallback for the Rokid touchpad.
Control Mapping
All interactions map to three input sources. Use the table below as a reference when testing on different hardware.| Intent | Rokid Glasses touchpad (KeyEvent) | Voice command | Android touchscreen |
|---|---|---|---|
| Select / OK | Tap (KEYCODE_ENTER) | select | Tap |
| Back / cancel | Double tap (KEYCODE_BACK) | back | Double tap |
| Move focus right/down | Swipe forward (KEYCODE_DPAD_DOWN) | next | Swipe right |
| Move focus left/up | Swipe back (KEYCODE_DPAD_UP) | previous | Swipe left |
Do not disable the back control on your app’s root screen. On Rokid Glasses the double-tap back is the only way to exit the app.
Setup
1. Download the Vosk Model
Vosk handles offline voice commands. Run the download script before your first build:2. Emulator Setup (optional)
If you want to develop without physical glasses, create an AVD with a Rokid-matching screen shape.Configure the AVD for Rokid screen dimensions
Edit
~/.android/avd/glass_480x640.avd/config.ini and add or update these four keys:Host microphone passthrough is optionally available: add
hw.audioInput=yes to config.ini, start the emulator with -allow-host-audio, then run adb emu avd hostmicon. In practice, camera and microphone passthrough on the emulator are not always stable enough for reliable development testing.Build and Install
Build a debug APK:Architecture
The app uses aScreenController pattern to keep each screen’s state, rendering, and input handling isolated from the activity shell. MainActivity owns the lifecycle, permissions, and input routing; each screen is a self-contained controller class.
| Class | Responsibility |
|---|---|
MainActivity | Activity shell: shared lifecycle, permissions, Rokid/emulator input mapping, screen navigation. |
RokidHudViewportLayout | Fixed 3:4 HUD viewport container that keeps phone rendering letterboxed to the Rokid Glasses shape. |
ScreenController | Shared screen abstractions and navigation results. |
MenuScreenController | Main menu screen: focus navigation, select action. |
AudioScreenController | Audio test tones: play/stop controls. |
CameraScreenController | Live camera preview. |
MicrophoneScreenController | Live microphone level meter and current voice-command status. |
VoiceCommandRecognizer | Vosk model unpacking, endpoint tuning, AudioRecord loop, partial/final result parsing, and command dispatch. |
Screens
The app has four screens you can navigate between using the control mapping above:- Menu — root screen with navigation to the three feature screens.
- Camera — live camera preview rendered on the HUD.
- Audio — playback test tones to verify speaker output.
- Microphone — live input level meter plus the current Vosk voice-command recognition status.
Key Files
| File | Description |
|---|---|
app/src/main/java/…/MainActivity.kt | Activity shell for lifecycle, permissions, input mapping, and screen navigation. |
app/src/main/java/…/RokidHudViewportLayout.kt | 3:4 letterbox container for phone/emulator rendering. |
app/src/main/java/…/ScreenController.kt | Base screen abstractions and navigation result types. |
app/src/main/java/…/MenuScreenController.kt | Menu screen state and rendering. |
app/src/main/java/…/CameraScreenController.kt | Camera preview screen. |
app/src/main/java/…/AudioScreenController.kt | Audio test tone screen. |
app/src/main/java/…/MicrophoneScreenController.kt | Microphone level meter and Vosk status screen. |
app/src/main/java/…/VoiceCommandRecognizer.kt | Vosk model loading, AudioRecord loop, and command dispatch. |
app/src/main/res/layout/activity_main.xml | Shared HUD chrome with per-screen layout includes. |
scripts/download_vosk_model.sh | Downloads the Vosk ASR model into the project assets. |