Voice commands are one of the most powerful features of Google Glass and other Android-based smart glasses. Instead of relying on touch input, users can control applications using natural speech, making hands-free interaction ideal for healthcare, logistics, manufacturing, and field services.
In this tutorial, you'll learn how to add voice recognition to your Google Glass Android application using Kotlin.
Why Use Voice Commands?
Voice interaction improves both usability and productivity by allowing users to:
- Navigate screens hands-free
- Start workflows instantly
- Capture information while working
- Improve safety in industrial environments
- Reduce manual interactions
Prerequisites
Before you begin, ensure you have:
- Android Studio
- Basic Kotlin knowledge
- A Google Glass or Android-based smart glasses device
- Android SDK installed
Step 1: Add Audio Permission
Open AndroidManifest.xml and request microphone access.
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
You'll also need to request this permission at runtime on Android 6.0 and later.
Step 2: Launch Voice Recognition
Android provides a built-in speech recognition intent.
private fun startVoiceRecognition() {
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intent.putExtra(
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
)
intent.putExtra(
RecognizerIntent.EXTRA_PROMPT,
"Say a command"
)
startActivityForResult(intent, 100)
}
This opens the Android speech recognition interface and listens for spoken input.
Step 3: Receive Voice Commands
Handle the recognition result inside your activity.
override fun onActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 100 && resultCode == RESULT_OK) {
val results = data?.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS
)
val command = results?.firstOrNull()
command?.let {
processCommand(it)
}
}
}

The recognized speech is returned as text, which you can process in your application.
Step 4: Execute Commands
Create a simple command handler.
private fun processCommand(command: String) {
when (command.lowercase()) {
"start" -> {
// Start workflow
}
"camera" -> {
// Open camera
}
"next" -> {
// Next step
}
"finish" -> {
// Complete task
}
else -> {
// Unknown command
}
}
}
You can extend this logic to support dozens of custom voice commands.
Best Practices
To create a reliable hands-free experience:
- Keep commands short and easy to pronounce.
- Avoid similar-sounding command phrases.
- Provide clear visual feedback after recognition.
- Handle unrecognized speech gracefully.
- Support offline functionality whenever possible.
Common Enterprise Use Cases
Voice commands are widely used in Google Glass applications for:
- Warehouse picking
- Equipment inspections
- Medical documentation
- Field technician workflows
- Navigation between work instructions
- Remote assistance
Tips for Better Performance
For the best user experience:
- Minimize background processing while listening.
- Test in noisy environments.
- Cache frequently used data.
- Keep UI updates lightweight.
- Optimize battery consumption during long sessions.
Conclusion
Adding voice commands to a Google Glass Android app is straightforward thanks to Android's built-in speech recognition APIs. By combining Kotlin with Android's voice capabilities, you can build intuitive, hands-free applications that improve productivity and safety across enterprise environments.
As your application grows, consider integrating on-device speech recognition, natural language processing, or AI assistants to create even smarter wearable experiences.

SDK Flutter: https://github.com/v-modal/vmodal_sdk_flutter
SDK Android: https://github.com/v-modal/vmodal_sdk_android
Discord: https://discord.gg/K72z28KUx

Top comments (0)