0

Even after updating the beacon manager with new parser the scan-filter is still using old beacon parser and failing to parse.

The old beacon parser is

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

Setting new beacon parser

        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);

Scan results after enabling debug on Alt-Beacon library

 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
Nikhil
  • 91
  • 1
  • 7

1 Answers1

0

If you modify your beacon parsers after you start scanning by calling beaconManager.bind() or constructing RegionBootrap(...), then you need to manually apply your changes with beaconManager.applySettings()

While the above works, it is usually easier just to move the code that sets the beacon parsers above the code that starts scanning.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204