简体   繁体   English

有没有办法修复 Android 中的 BLE 广告间隔?

[英]Is there a way to fix a BLE advertising interval in Android?

I'm making an Android application and I'd need to send advertising data at a fixed advertising interval.我正在制作一个 Android 应用程序,我需要以固定的广告间隔发送广告数据。

I've tried setting an advertising interval value using the setInterval() function from AdvertisingSetParameters class, but when I check the advertising interval in a scanner device using nRF Connect or BLE Scanner applications, it shows a lot of variance between advertising intervals.我尝试使用AdvertisingSetParameters class 中的setInterval() function 设置广告间隔值,但是当我使用nRF ConnectBLE Scanner应用程序检查扫描仪设备中的广告间隔时,它显示广告间隔之间存在很大差异。

To sum up, I'd like to know if it's possible to fix an advertising interval in an Android application .总而言之,我想知道是否可以在 Android 应用程序中修复广告间隔

Thank you in advance for your time!提前感谢您的宝贵时间!

According to documentation , you can set the advertising interval using the setInterval() function of the AdvertisingSetParameters class, as you said.根据文档,您可以使用AdvertisingSetParameters class 的setInterval() function 设置广告间隔,如您所说。 The advertising interval set is fixed.广告间隔设置是固定的。

The phenomena you are experiencing could be due of two possible causes:您遇到的现象可能是由于两个可能的原因:

  • Your smartphone is broadcasting another set of advertising packet with different advertising interval您的智能手机正在广播另一组不同广告间隔的广告包
  • the scan of BLE advertising messages it fails to capture all packets as often as they were emitted, maybe you are making test in an enviroment crowned of BLE devices扫描 BLE 广告消息时,它无法像发出它们一样经常捕获所有数据包,也许您正在一个由 BLE 设备加冕的环境中进行测试

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

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