A modern Android application built with Jetpack Compose that converts speech to text in real-time using Android's SpeechRecognizer API.
- Real-time speech recognition with partial results
- Modern Material Design 3 UI
- Animated microphone button with visual feedback
- Error handling with user-friendly messages
- Clear and intuitive interface
- Permission handling for microphone access
- Clone or download the project
- Open in Android Studio
- Sync Gradle files
- Run on your device or emulator
The app follows modern Android development practices:
- MVVM Architecture - Separation of concerns with ViewModel
- Jetpack Compose - Declarative UI framework
- StateFlow - Reactive state management
- Kotlin Coroutines - Asynchronous operations
Defines the contract for speech recognition functionality with:
text: StateFlow<String>- Recognized text streamisListening: StateFlow<Boolean>- Listening stateerror: StateFlow<String?>- Error messagesstart(),stop(),destroy()- Control methods
Handles Android SpeechRecognizer API:
- RecognitionListener callbacks
- Partial and final results processing
- Comprehensive error handling
- Intent configuration for optimal recognition
Manages application state:
- Initializes and coordinates speech recognition
- Exposes StateFlows for UI observation
- Handles lifecycle and cleanup
- Permission handling
- Animated UI components
- Status indicators
- Error display with dismissal
- Launch the app
- Grant microphone permission when prompted
- Tap the microphone button to start listening
- Speak clearly into the microphone
- View real-time transcription on screen
- Tap again to stop listening
- Use "Clear" button to reset text
The app handles various speech recognition errors:
- Audio recording errors
- Network connectivity issues
- No speech detected
- Permission issues
- Service unavailability
Speech recognition not available:
- Ensure Google app is installed and updated
- Check internet connection
- Verify device has microphone
Permission denied:
- Go to Settings > Apps > [App Name] > Permissions
- Enable microphone permission
No results:
- Speak louder and clearer
- Check microphone is not blocked
- Ensure quiet environment