onBeaconsDiscovered comes back as randomly sorted

Hi folks,

I am playing with ranging on Android using the 0.9.3 API version in my gradle.
Whenever the onBeaconsDiscovered callback is executed, the list of beacons in that comes as randomly sorted. Normally, it should be sorted in increasing order of accuracy (distance in meters) or decreasing RSSI. I log the results of ranging as follows:

public void onBeaconsDiscovered(Region region, List<Beacon> list) {
            for (Beacon b : list) {
                Log.d("Beacon", " major " + b.getMajor() + " minor " + b.getMinor() + " rssi " + b.getRssi() + " distance " + Utils.computeAccuracy(b));
            }
        }

My output is as follows:

10-21 08:43:14.313 29493-29493/com.beacons D/Beacons﹕ Beacon major 42672 minor 31474 rssi -78 distance 1.4144814671335821
10-21 08:43:14.313 29493-29493/com.beacons D/Beacons﹕ Beacon major 34310 minor 40774 rssi -75 distance 1.0935494704614068
10-21 08:43:14.315 29493-29493/com.beacons D/Beacons﹕ Beacon major 11905 minor 41197 rssi -100 distance 8.901886235883033

Is this something observed by others as well?

Hi @sky, I’m going to double check it on our side. The contract is that they should be storted by RSSI.

@sky
Sorry, contract is of course that beacons are sorted by their accuracy (not RSSI). Can you check it again?

Can you do just log whole list of beacons and paste it here? (sth like System.out.println(beacons)).

1 Like

Hi @wiktor, thank you for looking into this. Currently, I am working on a different app and when I print the list of beacons, it comes back as properly sorted. I will let you know if this behavior changes in the future.

1 Like