I am using the AltBEacon Android library for developing an iBeacon app for Android devices. I am scanning for beacons, however, only two out of four
OK, I finally solved it. I ordered according to the beacon MAC address. So instead of:
public void initAll(Collection newBeacons) {
this.beacons.clear();
this.beacons.addAll(newBeacons);
}
I did:
public void initAll(Collection newBeacons) {
this.beacons.clear();
this.beacons.addAll(newBeacons);
//Sort
Collections.sort(this.beacons, new Comparator() {
@Override
public int compare(Beacon b1, Beacon b2) {
String mac1 = b1.getBluetoothAddress();
String mac2 = b2.getBluetoothAddress();
return mac1.compareTo(mac2);
}
});
}