Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitor non-beacon BLE devices (Android Beacon Library)

Using Android Beacon Library, is it possible to monitor non-beacon BLE devices ? if yes, how can I estimate their distance using rssi without txPower?

like image 540
Droider Avatar asked Nov 30 '25 06:11

Droider


1 Answers

Yes, it is possible to detect non-beacon BLE devices with the library. You can also calculate the estimated distance to the devices if you first measure the known rssi at one meter for the device.

The code below shows how to do this:

    final DistanceCalculator distanceCalculator = new ModelSpecificDistanceCalculator(this, null);
    final int rssiAtOneMeter = -59;

    mBeaconManager.setNonBeaconLeScanCallback(new NonBeaconLeScanCallback() {
        @Override
        public void onNonBeaconLeScan(BluetoothDevice bluetoothDevice, int rssi, byte[] bytes) {
            Double estimatedDistnaceInMeters = distanceCalculator.calculateDistance(rssiAtOneMeter, rssi);
            // TODO: do something with estimatedDistanceInMeters
        }
    });
like image 101
davidgyoung Avatar answered Dec 02 '25 19:12

davidgyoung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!