Search code examples
ibeacon-androidaltbeacon

Can we change/add/remove beaconparser and region if scanning has already started


Can we change/add/remove beaconparsers and regions after scanning started ?

Because i want to add/remove regions dynamically according some conditions...

There is some explanation in this post Exception when trying to add a BeaconParser to AltBeacon lib that it is possible to change beaconparsers since version 2.6 but when i tried it doesn't take effect.

Any help would be appreciated....


Solution

  • No, you cannot modify the BeaconParser instances after scanning has started as of the 2.10 version of the AndroidBeaconLibrary. This is because they are copied to the scanning service at that time, and are not synchronized.

    Prior to version 2.6 it would cause a crash. As of version 2.6, it will not crash, but also not have any effect. Unreleased changes planned for the 2.11 release will allow changing these after scanning has started and have them take effect.

    That said, you can add and remove regions dyanamically even after scanning has started. So it is possible to set up all the parsers you will need up front, then only change the regions after you start scanning.