All beacons are not shown in Android using altBeacon library

后端 未结 2 1692
后悔当初
后悔当初 2021-01-06 04:56

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

相关标签:
2条回答
  • 2021-01-06 05:21

    OK, I finally solved it. I ordered according to the beacon MAC address. So instead of:

    public void initAll(Collection<Beacon> newBeacons) {
        this.beacons.clear();
        this.beacons.addAll(newBeacons);
    }
    

    I did:

    public void initAll(Collection<Beacon> newBeacons) {
    
        this.beacons.clear();
        this.beacons.addAll(newBeacons);
    
        //Sort
        Collections.sort(this.beacons, new Comparator<Beacon>() {
            @Override
            public int compare(Beacon b1, Beacon b2) {
                String mac1 = b1.getBluetoothAddress();
                String mac2 = b2.getBluetoothAddress();
    
                return mac1.compareTo(mac2);
            }
        });
    }
    
    0 讨论(0)
  • 2021-01-06 05:24

    A few thoughts:

    1. Try using an off-the-shelf beacon detection program like Locate, which uses the same Android Beacon Library under the hood. If the program detects your beacons reliably, then it is probably an issue in the custom code you mention.

    2. Make sure your beacons are transmitting frequently enough. The baseline transmission frequency is 10 Hz, but the library with default settings will pick up beacons reliably that are transmitting at least 1 Hz. Increasing the mBeaconManager.setForegroundScanPeriod(); as you describe should help this, but if the beacons are only transmitting at 0.1 Hz, then you would still have problems like you describe.

    3. Some Android devices have a combined Wi-Fi/Bluetooth chip that prevents reliable simultaneous operation of both these radios. Try disabling Wi-Fi and see if you get the same result.

    0 讨论(0)
提交回复
热议问题