home-assistant / home-assistant/android
"Media Sessions" can be tracked without the heavy performance & battery impact as a NotificationListenerService.
- Dominant language
- Kotlin
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 81
Description
**Is your feature request related to a problem? Please describe.**
Media sessions can be tracked without the heavy performance & battery impact as a NotificationListenerService.
**Describe the solution you'd like**
If "Media Session" is the only enabled sensor in Notification sensors, then `NotificationListenerService.requestUnbind()` can be used to stop monitoring notifications while keep Media Session tracking. Be sure to call `NotificationListenerService.requestRebind()` if any of the Notification sensors is enabled afterwards.
After this optimization is implemented, "Media Session" can be moved out of the "Notification sensors" group in configuration UI, since it is unrelated to notification monitor, either technically or reasonably.
**Describe alternatives you've considered, if any**
N/A
**Additional context**
NotificationListenerService working in "connected" mode can be a heavy performance impact if notifications are updated frequently on the device, especially for apps showing real-time information in sticky notifications (such as network speed, download progress). As a result, the battery consumption will also increase a bit.
Contributor guide
Assessment
This issue has not been assessed yet.