Doze Mode / Standby Application During Audio Playback

I noticed a problem with my audio streaming application on Android 6.0 devices. Stream audio through HLS over a network connection. Audio playback occurs in the front-end service with active notification. I noticed that when the application enters the dose / application standby mode, the Wi-Fi connection is lost and playback is paused. My service is in the foreground and has an active notification, which, according to the documents, should qualify my application so that it does not interrupt. I also purchase and support Wifi Lock. I read about how to set up my apps, but apps like Spotify don't ask for special permissions to avoid this problem. Any thoughts or suggestions?

+5
source share
1 answer

The recommended solution is to have separate processes, one for audio playback and one for the user interface. Check out this long chain for more details.

Here is the relevant section from Ms. Hackborn:

... your foreground service starts in a different process than the action. From what I see, everything will be fine. I would be interested to know if you have the desired behavior.

And this is actually our recommended practice for this situation - if you have a long-term foreground service, it should be in a separate process from the action, so it does not force all the memory associated with the activity to be kept. (That's why this error went away; all of our [Google] applications use this template.)

+2
source

Source: https://habr.com/ru/post/1243158/


All Articles