Closed sparklton closed 8 years ago
To get background modes to work on iOS you need to put "UIBackgroundModes
key with the bluetooth-central
value in its Info.plist
file". See The bluetooth-central Background Execution Mode.
I use cordoba-custom-config
because it automates my workflow. Too bad this doesn't work with XDK. You could manually edit the Info.plist file, use a Cordova hook, or potentially some other Intel XDK specific solution.
Once you figure something out, please submit a pull request to the README.md to let others know how you solved this.
@don - thank you for the reference, I will take it to the other side of the pond (XDK) to figure out how to achieve the same result without the hooks they don't support. Will keep this updated.
OK, there is a solution for bypassing the usage of cordova-custom-config with Intel XDK which doesn't support Cordova hooks.
I created a dummy plugin just as described in the link, added it into XDK build and voila iPhone BLE works in the background like a champion. Here's my plugin.xml.
<?xml version="1.0" encoding="UTF-8"?>
<plugin
xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="ble-plist-plugin"
version="0.0.1"
>
<name>Dummy plugin</name>
<description>Adds info to iOS plist file</description>
<license>BSD-3</license>
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<!-- iOS applications need additional configuration to allow Bluetooth to run in the background. -->
<platform name="ios">
<config-file parent="UIBackgroundModes" target="*-Info.plist">
<array>
<string>bluetooth-central</string>
</array>
</config-file>
</platform>
</plugin>
Hello, My question is about background ble operation on iOS devices described here.
Adding cordova-custom-config for an additional configuration on iOS will not work with Intel XDK which we use for the builds. I wonder if there is any other way to make this work? Switching entire build system to inject one parameter for one platform sounds quite radical. Anything else we can do to achieve the same result?