I'm currently working on a showcase app using BLE beacons from BEACONinside. I have set up my app to range two of my beacons (thus having 2 Region
s). This works fine and I receive all the callbacks and all the beacon info I need.
I'm monitoring the reported distance and noticed that it will not update the distance values right away, but gradually. Looging each callback I see the reported distance decreasing slowly, even if I run towards the beacons. That means, even with a (for testing) very low scanning interval, I reached the beacons and still have to wait up to ten seconds for the reported distance to reflect the proximity.
Is there a reason for that, and can I tweak a setting to have it updating right away?
My scenario is simply two beacons placed at different points and I want to trigger an action when I get closer to them. So using ranging instead of monitoring would be the way to, right? At the moment I compare the last three measurements and see if I got closer to the beacon.
Thanks!
Found the solution to this myself. I saw that the library will use a running average of the RSSI to calculate the distance. The sample expiration time is by default 20 seconds. This would explain the gradually updating distance.
So calling
RangedBeacon.setSampleExpirationMilliseconds(5000);
with 5 seconds being just what I was experimenting with, gives a faster response time and so far a good detection rate of the regions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With