I have 10 beacons to be detected by the library, they are placed randomly across a 10 meter radius.
In each scan, I only get 3-4 beacons to be detected, and in the following scan (with the same exact phone position) 2 or 3 of those disappear and I end up with only 1 update.
In the first scan:
D/Beacon: 3 :RSSI:-79 Distance: 3,66
D/Beacon: 1 :RSSI:-73 Distance: 4,22
D/Beacon: 2 :RSSI:-77 Distance: 2,66
D/Beacon: 4 :RSSI:-85 Distance: 3,26
Then in the following scan:
D/Beacon: 1 :RSSI:-82 Distance: 3,55
D/Beacon: 2 :RSSI:-72 Distance: 2,58
And next:
D/Beacon: 6 :RSSI:-73 Distance: 3,11
D/Beacon: 2 :RSSI:-73 Distance: 2,52
Is there any specific reason behind this, and if so, is there a way to solve it or minimize these events?
For example, would specifying the UUID for the region to scan help this cause?
It seems your beacons are often not detected in during the ranging cycle. This typically happens because they are not advertising frequently enough. When a beacon does not appear in the list, that is the Android Beacon Library's way of telling you that the beacon was not detected since the last ranging callback.
It's easy to add smoothing logic if you want to keep treating them as visible despite the fact that they haven't been detected in awhile. Here's a class that does exactly that, retaining them for a minimum of 10 seconds before it will drop them off the detected list:
To use this class, place the following line wherever you get beacon ranging updates:
val smoothedBeacons = BeaconRangingSmoother.shared.add(beacons).visibleBeacons
The above will convert the list beacons with dropouts (
beacons) to one without dropouts (smoothedBeacons).