Blurr Android Voice Assistant Development
Development guidelines for building and maintaining Blurr, an Android application that functions as an AI assistant with voice control capabilities.
Project Overview
Blurr is an Android AI assistant that allows users to interact with their devices using natural language voice commands. It leverages Google Gemini API for natural language processing and Puter.js for cloud services.
Technology Stack
**Core Technologies:**
Language: Kotlin 1.9+Framework: Android SDK 34 (min SDK 24)Architecture: MVVM with Kotlin CoroutinesAI: Google Gemini APICloud: Puter.js (auth, storage, KV database)Voice: Android Speech RecognitionUI: Jetpack Compose + XML layoutsDevelopment Environment Setup
Required Tools
Android Studio Ladybug or newerJDK 17Android SDK Platform 34Android SDK Build-Tools 34.0.0Android SDK Command-line ToolsAPI Configuration
Create `local.properties` in project root:
```properties
sdk.dir=/path/to/your/android/sdk
GEMINI_API_KEYS=your_comma_separated_gemini_keys
TAVILY_API=your_tavily_api_key
MEM0_API=your_mem0_api_key
```
**API Service URLs:**
Gemini API: https://makersuite.google.com/app/apikeyTavily: https://tavily.com/Mem0: https://mem0.ai/Code Structure
```
app/src/main/java/com/blurr/voice/
├── agents/ # AI agents for specific tasks
├── api/ # API clients (Gemini, Tavily, Mem0)
├── data/ # Models and repositories
├── ui/ # Activities and Compose components
├── utilities/ # Helper classes
├── services/ # Background services
└── managers/ # Feature managers (Puter, TTS, etc.)
```
**Key Files:**
`ConversationalAgentService.kt` - Main voice interaction service`MainActivity.kt` - App entry point`LoginActivity.kt` - Authentication flow`PuterManager.kt` - Puter.js integration`TTSManager.kt` - Text-to-speech`SpeechCoordinator.kt` - Speech recognition coordinationArchitecture Guidelines
Patterns
1. **MVVM**: Separate UI, business logic, and data layers
2. **Repository Pattern**: Abstract data sources behind repositories
3. **Manual Dependency Injection**: Constructor injection for testability
4. **Coroutines**: Use for all async operations and threading
Key Components
**Voice Interaction**: Floating button or voice activation**Task Automation**: App opening, messaging, alarms, etc.**Screen Analysis**: Accessibility services for context awareness**Memory System**: User preferences and interaction history**Authentication**: Puter.js-based user authBuild Commands
```bash
Build debug APK
./gradlew assembleDebug
Build release APK
./gradlew assembleRelease
Install debug APK to device/emulator
./gradlew installDebug
Run unit tests
./gradlew test
Run instrumented tests
./gradlew connectedAndroidTest
```
Testing Guidelines
**Test Locations:**
Unit tests: `app/src/test/`Instrumentation tests: `app/src/androidTest/`**Frameworks:**
JUnit 4 for unit testsEspresso for UI tests**Example test pattern:**
```kotlin
@Test
fun testFeature() = runBlocking {
// Arrange
val testData = createTestData()
// Act
val result = featureUnderTest.execute(testData)
// Assert
assertEquals(expected, result)
}
```
Debugging
Logcat Monitoring
```bash
Monitor Gemini API logs
adb logcat | grep GeminiApi
Monitor all app logs
adb logcat | grep "com.blurr.voice"
Clear logcat and start fresh
adb logcat -c && adb logcat
```
Common Debug Tags
`GeminiApi` - Gemini API calls and responses`ConversationalAgent` - Voice interaction flow`PuterManager` - Cloud service operations`TTSManager` - Text-to-speech eventsImportant Notes
Critical Constraints
**NEVER change AGP version in `gradle/libs.versions.toml` to 8.5.2** - Keep at 8.9.2Minimum SDK 24 (Android 7.0) for backward compatibilityAll API keys must be in `local.properties` (gitignored)Use coroutines for all background operationsFollow Material Design 3 guidelines for UIResource Locations
Main source: `app/src/main/java/com/blurr/voice/`Resources: `app/src/main/res/`Build config: `app/build.gradle.kts`Dependencies: `gradle/libs.versions.toml`Permissions Required
`RECORD_AUDIO` - Voice recognition`BIND_ACCESSIBILITY_SERVICE` - Screen analysis`SYSTEM_ALERT_WINDOW` - Floating button`FOREGROUND_SERVICE` - Background voice service`INTERNET` - API callsDevelopment Workflow
1. **Feature Development**: Create feature branch from `main`
2. **Code Changes**: Follow MVVM pattern, write tests
3. **Local Testing**: Run unit and instrumentation tests
4. **Manual Testing**: Install on device/emulator
5. **Code Review**: Submit PR with test coverage
6. **Merge**: Squash and merge to `main`
Best Practices
Use `sealed class` for state managementLeverage Kotlin extensions for cleaner codeDocument public APIs with KDocHandle errors gracefully with try-catch and Result typesUse `viewModelScope` for ViewModel coroutinesImplement proper lifecycle awareness in UI componentsCache API responses when appropriateUse string resources for all user-facing text