home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.07k stars 587 forks source link

Use a foreground service for reliable background transmitting #4347

Open dshokouhi opened 1 month ago

dshokouhi commented 1 month ago

Summary

Hopefully fixes: #3159 by implementing a similar foreground service like in #3369 based on the docs to create a "fake" scanner that looks for nothing to help keep the transmitter alive.

Needs end user testing. 🤞

Screenshots

image

image

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#pending

Any other notes

Code may not look pretty for now but wanted to get end user feedback

jpelgrom commented 1 month ago

Maybe it's good to split the Bluetooth scan permission into its own PR which we can quickly approve+merge as that fixes an obvious oversight/bug, whereas the foreground service is an effort to improve things but also introduces new behavior?

dshokouhi commented 1 month ago

Maybe it's good to split the Bluetooth scan permission into its own PR which we can quickly approve+merge as that fixes an obvious oversight/bug, whereas the foreground service is an effort to improve things but also introduces new behavior?

actually the scan permission is required in this PR because we are now using the scanner in this sensor where we were not before

jpelgrom commented 1 month ago

I missed that's new, sorry. In that case never mind and let's wait for positive results.

dshokouhi commented 1 month ago

Agreed this requires end users to confirm its working for them as I cannot reproduce