jpc*_*der 13 bluetooth objective-c core-bluetooth bluetooth-lowenergy ios7
我想要的是我的iOS设备一直在宣传蓝牙LE服务,即使应用程序没有运行,这样我就可以对其进行另一次iOS设备扫描并找到它.我在这里遵循Apple的背景说明:
我可以让它在前台做广告,有时在后台做广告,但它不会一直保持广告.如果您将其设置为在后台运行,即使设备重启后它也不应该开始做广告,就像后台位置服务在重启后自动开始工作一样?他们在Apple的文档中没有列出(或很难找到)的后台限制吗?有没有人在后台正确地拥有Core Bluetooth Peripheral广告的例子?
谢谢...
如果您将bluetooth-peripheral背景模式添加到应用程序的plist,则可以进行背景广告.一旦你这样做,你的应用程序将继续接收回调,即使背景.
The advertisement is a tricky beast as Apple implemented several optimizations to reduce the power consumption and these reduce the quality of the advertisement as soon as the app is backgrounded. Namely: the rate is reduced severely, the advertised services are not included and the local name is not included either. Once the app comes back to foreground, these restrictions are invalidated.
In the general case, this kind of backgrounded operation requires the app to be running. With iOS 7 the restoration process has been implemented that allows the OS to act on the app's behalf while it is terminated and restore the app when some transmission or other operation is imminent. This requires you to add the restoration key to the initialization options of the CBPeripheralManager/CBCentralManager. Starting your application once is still required but after that, iOS will continue to act as the BLE facade towards the centrals/peripherals.
更新:我在Apple bluetooth-dev列表上运行了一个循环以及这个问题,发现Core Bluetooth管理器在重启后被宣布无法恢复.这没有在任何文档中描述,但可能在WWDC视频中提到过.我们应该提交一个错误并复制它以提高Apple的意识.
| 归档时间: |
|
| 查看次数: |
9854 次 |
| 最近记录: |