| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Smart Notification Listener is an Android library that allows applications to listen to system notifications and expose them as a reactive StateFlow. The library is designed for modern Android applications using Jetpack Compose and follows clean architecture principles.
The goal of this library is to provide a reusable, lifecycle-safe, and Compose-friendly way to observe system notifications, while keeping permission handling and UI responsibilities fully in the application layer.
Add JitPack repository to your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}Add dependency to your app module build.gradle.kts:
implementation("com.github.pascaladitia:smart-notification-listener:1.0.1")This library requires Android Notification Listener Access. This permission is not a runtime permission and cannot be requested using a dialog.
The user must enable it manually from system settings.
Typical path:
Settings → Notifications → Notification access → Your App → Allow
Notes:
Notifications are exposed as a StateFlow and can be collected in a lifecycle-aware manner.
Example with Jetpack Compose:
val notifications by SmartNotificationListener
.notifications
.collectAsStateWithLifecycle()Example using LazyColumn:
LazyColumn {
items(
items = notifications,
key = { it.packageName + "-" + it.id + "-" + it.postedAt }
) { notification ->
Text(
text = notification.appName + ": " + notification.title
)
}
}Important:
Permission handling is intentionally not included in the library.
Recommended flow:
This approach ensures better UX, Play Store compliance, and library reusability.
smart-notification-listener/ ├── core Notification repository and internal state ├── service NotificationListenerService implementation ├── model Notification data models ├── utils Public API access └── sample-app Jetpack Compose sample application
MIT License
Copyright (c) 2026 Pascal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to deal in the Software without restriction.
The software is provided "as is", without warranty of any kind.
Pascal
GitHub: https://github.com/pascaladitia
| Back | FazBrowse Home | New Git URL |