我希望继续扫描蓝牙设备,并且我希望应用程序在后台运行。可能吗?似乎如果我有一个连接的蓝牙设备,并且如果有数据传输,那么该应用程序会在后台保持唤醒状态。但是,如果我只是在后台扫描,即使我选中了 Uses Bluetooth LE accessories
(plist 中的 bluetooth-central
),应用程序最终也不会运行。
有没有办法让应用在后台运行并持续扫描设备?
最佳答案
根据苹果开发者文档技术问答。
Can I use an iOS device to issue iBeacon advertisements while my app is in the background? Answer: No. For an iOS device to issue iBeacon advertisements, the app requesting this functionality must be frontmost, with the screen turned on and the device unlocked.
引用 - https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf
我找到了这篇文章,其中提供了一些在某些特定情况下在后台连接 BLE 的详细信息。 https://medium.com/@cbartel/ios-scan-and-connect-to-a-ble-peripheral-in-the-background-731f960d520d
关于iOS蓝牙后台模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34117336/