Piotr Czarnołęski Piotr Czarnołęski - 5 months ago 35
Android Question

AltBeacon Android Library - Adjust variation in time

according to official Android Beacon Library documentation at https://altbeacon.github.io/android-beacon-library/distance_vs_time.html - the averaging time is adjustable, however I found it impossible (so far) to change the variation from 20 seconds (default) to 5 seconds, using code provided:

BeaconManager.setRssiFilterImplClass(RunningAverageRssiFilter.class);
RunningAverageRssiFilter.setSampleExpirationMilliseconds(5000l);


I'm creating BeaconManager object like so (for Eddystone beacons ranging):

BeaconManager beaconManager = BeaconManager.getInstanceForApplication(getApplicationContext());
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"));
beaconManager.bind(this);


I've tried putting the code with the adjustments from the documentation just before BeaconManager instantialization, then tried again, just after it. It does not work in both cases. Did anyone run into similar issue?

Thanks,
Piotr Czarnołęski

Answer

This is supposed to work, but it looks like there may be a bug. Try calling:

RangedBeacon.setSampleExpirationMilliseconds(5000l);

And see if that works for you.