What exactly can CoreBluetooth applications do whilst in the background?

后端 未结 4 954
清酒与你
清酒与你 2020-11-29 15:30

The subject says it all, really. Documentation, insofar as it exists at all, suggests that apps written against the CoreBluetooth framework running on iOS devices can add \"

4条回答
  •  借酒劲吻你
    2020-11-29 16:11

    In addition to Chris's answer:

    • If your app has "bluetooth-central" background mode and is connected to a peripheral, you can receive notifications (peripheral:didUpdateValueForCharacteristic:error:) from the peripheral in background, even after 10minutes.

    So when you want to continuously run in background you have 2 options:

    • Run the "connect, disconnect, scan again" loop
    • Make the peripheral send notifications

    Later should be the "Event backgrounding" from WWDC 2012 Core Bluetooth videos https://developer.apple.com/videos/wwdc/2012/ But the former looks like a hack, I don't want to rely on it.

    I tested this on iPhone5, iOS6.1.4


    Apple finally released the Core Bluetooth Programming Guide and here's the official note about

    Core Bluetooth Background Processing for iOS Apps

提交回复
热议问题