# Notification Monitor An Android app that lets you select installed apps and monitors all notifications they receive — displayed in a live, scrollable log. --- ## Features - **App Selector** — browse all launchable apps on the device, search by name or package, and toggle monitoring per app (persisted across restarts) - **Live notification log** — new notifications appear instantly at the top of the list, showing app name, title, body, and timestamp - **Persistent history** — up to 200 entries are stored on-device and survive app restarts - **Permission banner** — automatically detects if notification access has not been granted and prompts the user - **Clear log** — one-tap menu option to wipe the history - **Boot-safe** — `BootReceiver` ensures the service is re-bound by Android after device reboot --- ## How to Build ### Requirements - Android Studio Hedgehog (2023.1.1) or later - Android SDK 34 - Minimum device/emulator API 26 (Android 8.0) ### Steps 1. Open the project in Android Studio (`File → Open` → select the `NotificationMonitor` folder). 2. Let Gradle sync finish. 3. Run on a physical device or emulator (`Run → Run 'app'`). --- ## First-Time Setup on Device Because `NotificationListenerService` is a privileged API, Android requires the user to manually grant access: 1. Launch the app — a dialog will appear immediately. 2. Tap **Go to Settings**. 3. Find **Notification Monitor** in the list and toggle it **ON**. 4. Confirm the system prompt. 5. Return to the app — the yellow warning banner disappears and monitoring is active. Alternatively, reach this screen any time via the **⋮ menu → Notification Access Settings**. --- ## Project Structure ``` app/src/main/ ├── AndroidManifest.xml ├── java/com/notificationmonitor/ │ ├── data/ │ │ ├── AppInfo.java — app metadata model │ │ ├── NotificationEntry.java — captured notification model │ │ └── PreferencesManager.java — SharedPreferences persistence │ ├── service/ │ │ ├── NotificationMonitorService.java — core NotificationListenerService │ │ └── BootReceiver.java — re-init after reboot │ └── ui/ │ ├── MainActivity.java — notification log screen │ ├── NotificationLogAdapter.java │ ├── AppSelectorActivity.java — app picker screen │ └── AppSelectorAdapter.java └── res/ ├── layout/ │ ├── activity_main.xml │ ├── activity_app_selector.xml │ ├── item_notification.xml │ └── item_app.xml ├── menu/menu_main.xml ├── values/ │ ├── strings.xml │ ├── colors.xml │ └── themes.xml └── drawable/ic_notification_bell.xml ``` --- ## Key Technical Notes - **`NotificationListenerService`** is the standard Android API for this use case. It requires the `BIND_NOTIFICATION_LISTENER_SERVICE` permission — this cannot be requested at runtime; it must be granted via the special Settings page. - **Local broadcasts** (`LocalBroadcastManager`) are used to push live events from the service to the MainActivity without coupling them. - **No third-party notification sniffing** — all data comes directly from Android's official API, so this is safe for personal use, but note that publishing an app with this permission to the Play Store requires Google approval. - The log is capped at **200 entries** in `PreferencesManager` to avoid unbounded SharedPreferences growth.