不定期从Eddystone信标获取Android信标库的范围更新



当使用TLM信标从Eddystone UID获取范围更新时,即使didRangeBeaconsInRegion()应该每秒调用一次,更新也是不定期的。我偶尔会在日志上看到更新,甚至有时8-10秒没有更新,然后偶尔再次更新。

下面日志的一部分显示了从检测到信标的那一刻起D/RangingActivity的零星性质;

D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: Stop Scan
D/BluetoothLeScanner: Start Scan
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
D/BluetoothAdapter: STATE_ON
STATE_ON
D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
I/ScanHelper: Non-distinct packets detected in a single scan.  Restarting scans unecessary.
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 16.9709421436514 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 37.302382194318774 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 31.25429550588763 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 28.936042431918796 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 26.86915572611937 meters away.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 398 seconds, has a battery level of 3320 mV, and has transmitted 77 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 18.93489852744025 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 419 seconds, has a battery level of 3320 mV, and has transmitted 81 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes
D/RangingActivity: I see a beacon transmitting namespace id: 0x00010203040506070809 and instance id: 0x04514000b000 approximately 35.47854961599127 meters away.
D/RangingActivity: Lux value is 12544 The above beacon is sending telemetry version 0, has been up for : 449 seconds, has a battery level of 3320 mV, and has transmitted 87 advertisements.
D/ScanRecord: parseFromBytes
D/ScanRecord: parseFromBytes

我的代码与以下文档中描述的相同:

https://developer.radiusnetworks.com/2015/07/14/building-apps-with-eddystone

https://altbeacon.github.io/android-beacon-library/eddystone-how-to.html

我尝试了不同的信标广告周期,但问题仍然存在。是否有办法定期获得范围更新,即每秒钟?

Thanks in advance…

我怀疑问题出在Eddystone-TLM框架本身。遥测帧是一个交错帧,它不像UID或主Eddystone信标类型那样经常发送。遥测技术只有在新的TLM帧出现时才会更新,正如您所描述的那样,这可能很罕见。库的扫描间隔无法控制这一点——这就是TLM的工作方式,它是硬件交错率的函数。

无论上述情况如何,库总是以定期间隔发送didRangeBeacons回调,尽管如果没有检测到检测到的信标列表可能为空。你的Eddystone-UID检出率应该更有规律。试着在你的didRangeBeacons回调中添加更多的日志记录,包括时间戳和信标计数,看看发生了什么。

你可以试着用一个修改过的Android Beacon Library进行测试来确认,并在必要时寻找你的代码中的任何差异。

添加beaconManager.setDebug(真正的);可以获得内部调试日志。

最新更新