I am working in a Streaming App (for a Webradio), and i am having a problem with the Exo Player: When we block the phone, after some minutes, the sound stop, and it ocour even some notification of other app arrives or i press the button to check the smartphone.
None of the App Inventor distros have background services feature.
It would be great but not available yet.
There’s a block to keep the screen from turning off though. Would that be useful for you?
There are many misconceptions about the term “background”. Background means only that the app is not not visible (eg after pressing the home button or the app is in sleep mode, black screen), but is not closed.
So if the screen goes into sleep mode or you press the home button, the sound (ExoPlayer) should continue to play …
Background task means that the app can execute somthing even when it is closed, this is not possible with Kodular and the other builders (Ai2, Thunkable etc.). So when the app is closed the sound will stop.
So if the sound stops even though the app was not closed, you’re making a mistake somewhere.
I tried here and this doesn’t works in this case, because if i want to block my phone the screen goes off…
So… it works for some minutes, and occour the problem. After some tests, it looks like the internet goes down, but i think it is not the correct problem, maybe battery optimization or anything…
So… i make some tests, and even if it’s an app with a button and exo player only, after a while it happens that sound stop…
Yeap… i tried now… the problem occours with WiFI and 3G/4G LTE…
I see the discussion, and now i think the problem is with Battery Optimization, because i tried use connected in power supply and the problem doesn’t occour…
I read some posts to solve this (battery optimization), but all of them have permissions to put in AndroidManifest.xml and execute an Android function to disable battery optimization for the app…
I tried all settings (including all battery optimization settings) on a Galaxy Note 8, API28 without success.
The important setting is: “KEEP WIFI ON DURING SLEEP” and this has gone (in Android 9).
Translated from German: “I have the same problem. I’ve been struggling through the forums for days and can’t find any suitable solutions. For me, Whats App and GMX are affected.”
I confirm closing the application after a few minutes.
Tested on EMUI 8, 9, 9.1, 10. (Android 8, 9, 10)
Setting “no saving battery” give nothing.
All other settings do nothing.
I had to add the screen turned on permanently to use the radio.
Unfortunately, Kodular has it and nothing can be done.
Does this only happen in sleep mode or even when the app is in the background (e.g. the home button was pressed)? How long does it take after the device has switched to sleep mode before the sound stops?
This happens regardless of the screen being turned off. Just use another application when you have not turned off ours. It will also be turned off after a few minutes.
I never counted that time. It takes from a few to several minutes.