【问题标题】:Alt Beacon Parser is not working even after adding new parser layout即使添加了新的解析器布局,Alt Beacon Parser 也无法正常工作
【发布时间】:2019-06-13 19:10:07
【问题描述】:

即使在使用新解析器更新信标管理器后,扫描过滤器仍在使用旧信标解析器并且无法解析。

旧的信标解析器是

 beaconParserList: altbeacon, m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25

设置新的信标解析器

        beaconManager.getBeaconParsers().clear();
        BeaconParser beaconParser = new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
        beaconManager.getBeaconParsers().add(beaconParser);

在 Alt-Beacon 库上启用调试后扫描结果

 D/BeaconParser: Processing pdu type FF: 0201061aff4c000215fb7dd88a496f42c49f4a382d8258b4ee03e8044ec41e09354141413d6d536d21366534563b74395a3d42497b2a4d6e417166474800 with startIndex: 5, endIndex: 29
 D/BeaconParser: This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 0201061aff4c000215fb7dd88a496f42c49f4a382d8258b4ee03e8044ec41e09354141413d6d536d21366534563b74395a3d42497b2a4d6e417166474800

【问题讨论】:

    标签: altbeacon ibeacon-android android-ibeacon


    【解决方案1】:

    如果您修改信标解析器之后通过调用beaconManager.bind()或构造RegionBootrap(...)开始扫描,那么您需要使用beaconManager.applySettings()手动应用您的更改

    虽然上述方法有效,但通常将设置信标解析器的代码移到开始扫描的代码上方会更容易。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多