简体   繁体   English

iOS应用程序在后台扫描BLE设备

[英]iOS app scan BLE device on background

我的应用程序使用scanForPeripheralsWithServices:扫描BLE设备,该参数指定为servicesUUIDs数组,有时可以快速发现外围设备,但有时需要等待一会儿。而我的应用程序是会话后台。那么,我如何才能尽快发现外围设备背景。

When the app is in the background iOS is enabling Bluetooth from time to time and it is not always listening. 当应用程序在后台运行时,iOS会不时启用蓝牙,并且它并不总是在监听。 This is to save battery and because the WiFi and Bluetooth share the same antenna and cannot send at the same time. 这是为了节省电池,并且因为WiFi和蓝牙共享相同的天线,并且不能同时发送。 To make it discover your peripheral as fast as possible you should if you have access to peripheral implementation, make sure the peripheral advertises itself as often as possible. 为了使它能尽快发现外围设备,如果可以访问外围设备实现,则应确保外围设备尽可能多地自我宣传。 I believe Apple recommends at least once each 20th ms. 我相信Apple建议每20毫秒至少一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM