home-assistant / home-assistant/android

"Media Sessions" can be tracked without the heavy performance & battery impact as a NotificationListenerService.

Open
#3,841 6 comments 0 reactions 0 assignees View on GitHub
enhancement sensor-tracking
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.