evothings / cordova-ble

Bluetooth Low Energy plugin for Cordova
http://www.evothings.com/
Apache License 2.0
242 stars 103 forks source link

Add support for background modes on iOS #85

Closed ghost closed 8 years ago

ghost commented 8 years ago

To enable BLE background mode on iOS, edit plugin.xml as follows, adding the config-file section "UIBackgroundModes":

<platform name="ios">
    <config-file target="config.xml" parent="/*">
        <feature name="BLE">
            <param name="ios-package" value="EVOBLE"/>
        </feature>
    </config-file>

    <config-file target="*-Info.plist" parent="UIBackgroundModes">
        <array>
            <string>bluetooth-central</string>
            <string>bluetooth-peripheral</string>
        </array>
    </config-file>

    <framework src="CoreBluetooth.framework" />

    <header-file src="src/ios/EVOBLE.h" />
    <source-file src="src/ios/EVOBLE.m" />
</platform>
ghost commented 8 years ago

Only bluetooth-central would be needed for the BLE central role.

ghost commented 8 years ago

Support for background scanning available in this branch: https://github.com/mikaelkindborg/cordova-ble/tree/background

Will be merged to master branch.