Cordova-plugin-background-mode rejected by iOS: ' remove the “audio” setting'

We are using the ‘cordova-plugin-background-mode’ by katzer and have been approved once by the iOS revision team after I demo a video of the app using the plugin. But when we attempted to update our app last week Apple rejected us and will not accept an other “demo video”.

Our Ionic App needs to run in the background and this cordova backgroud plugin seems to our only solution for this.

Apparently this plugin comes with an audio file at 0 volume that 'plays in the background in other words it’s ‘tricking’ or mimic native functionality to keep the app running in the background. Android seems to be ok with it but Apple sends us this.

The audio key is intended for use by apps that provide audible content
to the user while in the background, such as music player or streaming
audio apps. Please revise your app to provide audible content to the
user while the app is in the background or remove the “audio” setting
from the UIBackgroundModes key.

Obviously we can’t do that because then the core functionality of the app running in the background will not work. I guess this is what Hybrid Mobile App developers have to deal with to achieve certain native features.

enter image description here

Any Ionic devs out there who have figured out a work around for this?

1 Like

Any alternatives? Pleas help… anybody?

1 Like

Any solution for this? I am facing same issue…

Open the project in Xcode and go to Capabilities, make sure that “Audio, AirPlay, and Picture in Picture” is disabled under “Background Modes”. This needs to be done almost after every build… So you can either:

A. Get used to removing the tick before each release build
B. Setup a hook with a script to remove it, here’s my script:


#!/usr/bin/env node

var fs = require("fs");
var find = require("find");
var colors = require("colors");
var path = __dirname + "/../platforms/ios/";

find.file(/\-Info\.plist$/, path, function(files) {
	if(files.length > 1) {
		console.log("Multiple possible plist files found".red);
	} else if(files.length === 0) {
		console.log("No info plist found".red);
	} else {
		var plistpath = files[0];

		 * Determine app name
		var appname = plistpath.match(/([^\/\\]+)(\/|\\)[^\/\\]+$/)[1];

		 * Modify plist
		var plist = fs.readFileSync(plistpath, "utf8");
			plist = plist.replace(/\s+<string>audio<\/string>/, "");

		fs.writeFile(plistpath, plist, function(err) {
			if(err) {
				console.log("Failed to remove Audio from Background Modes in Capabilities".red);
				throw err;
			} else {
				console.log("Removed Audio from Background Modes in Capabilities and wrote to plist file".green);

And under the iOS platform in your config.xml:

<hook src="scripts/ios_fix_audio_background.js" type="after_platform_add" />
<hook src="scripts/ios_fix_audio_background.js" type="before_run" />
<hook src="scripts/ios_fix_audio_background.js" type="after_build" />

There might still be cases where it doesn’t work, so just remember to check every now and again.


Why hybrid apps? Native apps have the same limitations.

There’s a nice solution here:

You can use edit-config in the config.xml file:

<edit-config file="*-Info.plist" mode="overwrite" target="UIBackgroundModes">
    <array />