Objective-C/iOS:在后台保持蓝牙连接处于活动状态

发布于 2024-12-26 00:53:01 字数 364 浏览 5 评论 0原文

我已经研究了几天了,看起来当手机进入睡眠状态或应用程序在后台运行时,不可能保持蓝牙连接。但是,我发现一个应用程序声称它们可以一直运行: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美男兮 2025-01-02 00:53:01

您需要通过 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.

星光不落少年眉 2025-01-02 00:53:01

在 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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文