简体   繁体   English

iOS Android 无法检测到背景 BLE 广告

[英]iOS Background BLE advertising not detectable by Android

When an iOS BLE peripheral enters the background state, the advertising packets are not emitted in the regular manner and they are placed in a special “overflow” area which is only detectable by another iOS device explicitly looking for this device.当 iOS BLE 外设进入后台 state 时,广告数据包不会以常规方式发出,它们被放置在一个特殊的“溢出”区域中,只有另一个 Z1BDF605991920DB11CBDF8508204CEB4 明确寻找此设备时才能检测到该区域。

The bluetooth-peripheral Background Execution Mode 蓝牙外设后台执行模式

That said, you should be aware that advertising while your app is in the background operates differently than when your app is in the foreground.也就是说,你应该知道,当你的应用程序在后台时,广告的运作方式与你的应用程序在前台时不同。 In particular, when your app is advertising while in the background:特别是,当您的应用在后台投放广告时:

• The CBAdvertisementDataLocalNameKey advertisement key is ignored, and the local name of peripheral is not advertised. • CBAdvertisementDataLocalNameKey 通告键被忽略,并且外围设备的本地名称不被通告。

• All service UUIDs contained in the value of the CBAdvertisementDataServiceUUIDsKey advertisement key are placed in a special “overflow” area; • 包含在 CBAdvertisementDataServiceUUIDsKey 广告键值中的所有服务 UUID 都放置在一个特殊的“溢出”区域; they can be discovered only by an iOS device that is explicitly scanning for them.它们只能被明确扫描它们的 iOS 设备发现。

Is there any way an Android central (scanner) can detect any advertised custom UUID without having to connect to the iOS peripheral? Android 中央(扫描仪)有什么方法可以检测任何广告的自定义 UUID 而无需连接到 iOS 外围设备?

With "overflow" area I guess they mean Scan Response Data.对于“溢出”区域,我猜它们是指扫描响应数据。 To get that data, a device must perform an active scan, rather than a passive scan.要获取该数据,设备必须执行主动扫描,而不是被动扫描。 In an active scan, the scanner sends a scan request packet immediately after it detects an advertisement packet.在主动扫描中,扫描器在检测到广告数据包后立即发送扫描请求数据包。 The advertising device will only broadcast the scan response data if it detected a scan request.广告设备仅在检测到扫描请求时才会广播扫描响应数据。

Android devices only perform active scans, so you should be fine. Android 设备只执行主动扫描,所以你应该没问题。

EDIT: the answer above is not correct.编辑:上面的答案不正确。 See http://www.davidgyoungtech.com/2020/05/07/hacking-the-overflow-area for correct information.有关正确信息,请参阅http://www.davidgyoungtech.com/2020/05/07/hacking-the-overflow-area

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

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