How to prevent cordova app stopping in background while playing media

783 views Asked by At

I'm developing an app that plays audio (podcasts), and it should keep playing when the app is in the background.

I'm using the cordova-media-plugin.

In my config.xml I have:

<preference name="KeepRunning" value="true" />

It works most of the time, but even when the media is playing, the app will be closed if it is in the background and the audio will stop, at random moments.

I was expecting that an app that is playing media, even in background, would be prevented from being closed. Am I wrong?

Is there any way to overcome this? (In other words, is it possible at all to build an hybrid app that is a media player, without having this behaviour?)

I'm using cordova 6.5 and I'm testing in Android 6.0

1

There are 1 answers

1
BlackSlash On

There is a plug in that can help you: BackgroundAudio