How pilot51/voicenotify works
Project type and purpose
• Voice Notify is a single-module Android application written in Kotlin, using Jetpack Compose for UI, Room + DataStore for persistence, and Android’s NotificationListenerService and Text-to-Speech (TTS) APIs to speak incoming notifications.
File structure
• Top-level
• build scripts (build.gradle.kts, settings.gradle.kts, gradle/…)
• README, LICENSE, CI workflows
• app/
• schemas/ – Room database migration JSON
• src/main/AndroidManifest.xml – declares services, widget, tile, activities
• src/main/java/com/pilot51/voicenotify/
– Service.kt (NotificationListenerService subclass)
– VoiceNotifyTileService.kt (Quick Settings tile)
– AppWidget.kt (home-screen widget)
– MainActivity.kt + Compose screens (/ui) and view models
– prefs/ DataStoreManager, PreferenceHelper, Room entities, DAOs, Repository
– Utils, Constants, PermissionHelper, Shake (gesture detection), VNApplication
• No separate backend—entire logic runs on device, interacting with Android system services and local storage.
Key insights from README
• Core flow: listen for notifications → filter/transform based on user preferences → speak via TTS → optionally log to database → allow UI to view/change settings and logs.
• Provides suspend widget, quick-settings tile, quiet time, shake-to-silence, per-app overrides, backup/restore.
Main components and their interactions
a. Components
1. Android System Services
• NotificationListenerService (Service.kt)
• TextToSpeech engine
• Quick Settings Tile framework (VoiceNotifyTileService)
• AppWidgetProvider (AppWidget)
• Backup/Restore (zip to external storage)
2. Data Layer
• DataStore (DataStoreManager) for lightweight preferences
• Room Database (AppDatabase, entities in prefs/db) + AppRepository
3. Business Logic / Domain
• NotificationProcessor (in Service.kt + Utils)
• PreferenceHelper to fetch/interpret settings
• Shake detector to suppress speech
4. Presentation Layer
• MainActivity + Compose screens (AppListScreen, MainScreen, TtsConfigScreen, PreferenceRows, dialogs)
• ViewModels (AppListViewModel, PreferencesViewModel)
b. Data flows & relationships
1. Android system posts a status-bar notification → NotificationListenerService.onNotificationPosted()
2. Service fetches relevant prefs via PreferenceHelper/DataStoreManager or AppRepository
3. Applies filtering rules (ignore apps/text, quiet time, screen/headset state, shake)
4. Formats TTS message (Utils, Constants, NotifyList)
5. Sends utterance to Android TTS engine
6. Service logs notification details to Room via AppRepository
7. UI screens read prefs and log records from DataStore and Room via ViewModels
8. User changes settings → DataStoreManager or AppRepository updates persistence
9. Backup/Restore screen bundles DataStore + Room DB into ZIP and writes to external storage
10. Widgets and quick tile call into Service to toggle “suspended” state
c. Architectural patterns & principles
– MVVM for UI (Compose + ViewModel)
– Repository abstraction over DataStore + Room
– Single Android module—on-device micro-architecture layered by function
– Clear separation: System integration (services, widgets) vs domain logic vs data vs presentation
d. Key technologies
– Kotlin + Kotlin DSL Gradle
– Jetpack Compose
– AndroidX Room, DataStore
– Android NotificationListenerService, TileService, AppWidgetProvider
– Android TTS API
– Migration JSON under app/schemas for Room