蓝牙在使用反应本地杀死应用程序后仍处于活动状态
我在iOS上的蓝牙生命周期有问题。
我们正在使用React Antial和以下库( https://github.com/innnnoveit/ React-Native-Ble-Manager )管理我们的蓝牙设备。
当设备通过蓝牙发送所有数据时,这些设备会发送数据并清除其本地数据(我们仅使用BLE消息ACK,没有内部应用程序ACK)。
问题是,当应用程序被杀死时,iOS似乎可以保持打开状态,这使该设备认为它仍在发送由我们的应用程序正确处理的数据,并在末尾清除(这会导致数据丢失) 。
这是iOS的正常行为吗? (在应用程序被杀死后,BLE停留了一段时间,并且没有通过BLE寄出错误?)
是否有办法在杀死该应用程序时强制关闭BLE?
谢谢
I have a problem with the lifecycle of Bluetooth on iOS.
We are using React Native and the following library (https://github.com/innoveit/react-native-ble-manager) to manage our Bluetooth devices.
The devices sends data and clears its local data when it has sent all its data through bluetooth (we are only using ble messages ACK, no internal app ACK).
The problem is, that iOS seems to maintain the ble open when the app is killed, which is making the device think that it is still sending data that is processed correctly by our app, and clears it at the end (which causes data loss).
Is this a normal behaviour on iOS ? (the fact that the ble stays open for some time after the app is killed, and no errors are sent through ble ?)
Is there a way to force close the ble when the app is killed ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是正常的。操作系统可以打开连接并与应用程序共享。这些应用不会直接保持连接。在上一个应用程序发布之后,OS删除连接可能需要一些时间(通常按几秒钟的顺序,但有时更长)。
否。当应用程序被杀死时,没有办法做任何事情(我认为您要付费,例如通过在应用程序切换器上刷卡)。
综上所述,如果应用程序不再读取,我在这里感到有些惊讶,您会收到对设备的回复。当您说“ BLE消息ACK”时,特别是您的意思是哪个“ ACK”?您要回复响应数据包吗?还是您的意思是低级ACK?
Yes, this is normal. The OS holds open the connection and shares it with apps. The apps do not hold connections directly. It can take some time (generally on the order of seconds, but sometimes a bit longer) for the OS to drop the connection after the last app releases it.
No. There is no way to do anything when the app is killed (by which I assume you for force-quit, for example by swiping up on the app switcher).
All that said, I'm a bit surprised here that you're getting a write response back to the device if the app is no longer reading. When you say "ble messages ACK," specifically which "ack" do you mean? Are you getting a Write Response packet back? Or do you mean a lower-level ack?