Objective-C/iOS:在后台保持蓝牙连接处于活动状态
我已经研究了几天了,看起来当手机进入睡眠状态或应用程序在后台运行时,不可能保持蓝牙连接。但是,我发现一个应用程序声称它们可以一直运行: RunKeeper应用程序说:
版本2.5.1.0中的新增功能
- 支持使用Wahoo心率在后台跟踪心率 监视器。
有谁知道他们如何在应用程序处于后台时将心率数据发送到手机?
更新:
通过在我的 plist 中的“bluetooth-central”的“所需背景模式”下添加一个条目来使其正常工作。
I've been researching this for a couple of days now and looks like it's not possible to keep bluetooth connection alive while the phone goes to sleep or if the app is in the background. However, I have found one app that claims they can run all the time: RunKeeper app says:
What's New In Version 2.5.1.0
- Support for tracking heartrate in the background with Wahoo heartrate
monitor.
Does anyone know how they manage to send heart rate data to the phone while the app is in the background?
UPDATE:
Got it working by adding an entry in my plist under "Required background modes" for "bluetooth-central".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要通过 CoreBluetooth 框架使用新的蓝牙低功耗功能
另请注意,此功能目前仅适用于 iPhone4S,因为低功耗蓝牙功能取决于 iPhone 中的蓝牙硬件。
You need to use the new Bluetooth Low Energy feature via the CoreBluetooth Framework
Also note this is available currently only on iPhone4S since the Bluetooth Low Energy capability is dependent on the Bluetooth hardware in the iPhone.
在 Xcode 5 中,应用程序的功能中有一个后台模式部分。将后台模式设置为开启并选中“使用蓝牙 LE 配件”
In Xcode 5 there is a section for Background Modes in the your app's capabilities. Set Background Modes to ON and check "Uses Bluetooth LE accessories"