Background sound/music are cancelled after opening app (iOS)

We’ve developed an app that uses no sounds at all.

When we start the Capacitor app it cancels all sounds on background apps like Spotify etc. Is there any way to avoid this behavior?

Capacitor by itself shouldn’t be doing anything like this. Have you reviewed any plugins that you are using to make sure they aren’t requesting audio focus?

I will try that. Would not importing them in my .ts files be enough? Or should I remove them completely with npm uninstall / npx cap sync?

Hmmm…good question. It might depend on the plugin. Not sure if a plugin can initialize itself without being initialized in TS/JS. The safest bet would be probably to uninstall and do a cap sync so the native files remove any references.

Are you using a ton of plugins?

Yes, but I narrowed it down to a few suspects and the 2nd one was the culprit: cordova-plugin-background-mode

Fortunateley it appeared we actually weren’t using this plugin so we could remove it safely. We indeed needed to uninstall / npx cap sync. Simply removing the import didn’t work

Thanks for the help!

1 Like