I am using AltBeacon library to detect nearby beacons. The app works and is able to detect my beacons. However, it is not able to calculate distance - I am getting distance measurement value as "Infinity".
This is my code :
beaconManager.setForegroundScanPeriod(5100l);
beaconManager.setForegroundBetweenScanPeriod(11000l);
if (beacons.size() > 0) {
Log.i("Ranging", "inside detected : " + beacons.iterator().next().getDistance());
for (Beacon beacon : beacons) {
Log.i("RangingActivity", "Got rssi as : " + beacon.getRssi() + " and distance " + beacon.getDistance());
}
}
I get the following output in the log:
Got rssi as -53 and distance Infinity
What is going wrong in the distance measurement?