The problems with streaming / radio apps have been discussed intensively and extensively in all forums (AI2, Kodular, …) for years (also with the MIT and Kodular staff). Search the appropriate forums. I made a final statement on this and presented the solution, after testing this on dozens of devices and all Android versions from KitKat onwards.
So search the forum (and the corresponding other forums) and you will find what you are looking for.
A Background Task has nothing to do with that. It has no effect on Doze mode.
I just start the KeepAlive extension when the user turns off the screen, and stop the extension when user turn back on the phone screen so the notification isn’t visible for the user. If there’s a better way to do it, please let me know.
Also stay tuned for the music app I’m doing here’s some screenshots