App lose activity when going background #17
-
Hello, I have a problem, which maybe you can help. I play a stream with the plugin on IOS. Every X seconds, a script is triggered to fetch remote content (the current track title). It works very well when the app is in foreground. But as soon as I go to the home screen, the app which is in background does not trigger the script, even if the audio is currently playing. Is it normal ? If I open the app back, the script execute properly. Is it something which can be configure with the plugin? I though than playing a background audio would keep the app active. Let me know if it is not clear. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
Both iOS and Android pause JavaScript execution after a certain amount of time the app being in the background. Android seems to be around 5-10 minutes. Not sure the timing on iOS. Guessing you are using We have a similar problem with playing long audio and background music. Right now the main audio controls stopping the background music when it ends in the JS. If the app is in the background for a bit, the background music doesn't stop when the main audio stops until the app enters the foreground because JS has been paused. I have plans to add the stopping of the background music in native land so this doesn't happen. For your case though, I don't know of a solution. You would have to make your calls to your backend API in native land but obviously that isn't possible with this plugin. I think you would have to fork the plugin and add that logic. |
Beta Was this translation helpful? Give feedback.
Sorry, here is the correct video.
RPReplay_Final1734155840.MP4
The not playing is not causing an issue. I just thought than it prevent the app to stay active when in the background.
I will back as resolved for now, since I found another solution.