0

I am using the `AndroidProximityLibrary' for a project where i'm measuring the distance to the beacon and when it reaches / passes a certain distance it will do something.

Everything is working fine except the distances i'm receiving from the library have a big variation of values. Even if i'm standing in front of the beacon in clear nice of sight, i can get distance values that goes from 1,5 to 4 meters ( When i'm standing around 3 meters from beacon)

My real question is if i can somehow get more distance values so i can get rid of those spikes, currently i'm receiving beacon information around 2 distance values per second. Is is the beacon that is only sending information with that frequency ? or is it the library that is only doing the callbacks with that frequency ?

As a beacon, i'm using a raspberry pi configured like the RadiusNetwork tutorial. I'm using a nexus 5 hosting the client application.

FOliveira
  • 558
  • 4
  • 9

1 Answers1

0

The reason the values vary so much is because there was a bug in that library that only used a single signal strength measurement to estimate distance. The latest version of the Android Beacon Library (which shares much of the code of the library you mention) uses a running average of signal strength samples over a 20 second window. This smooths out the noise significantly.

Unfortunately the AndroidProximityLibrary has been discontinued, and no new updates are being provided. If you are not using the cloud data features of the library, your best option is to migrate to the Android Beacon Library 2.0, which has all the other features. A migration guide is available here.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Once again thank you very much for the quick answer! I'm working right now on the migration process! I also noticed i only got beacon information once per second .. is this a limitation from the lib or android ? – FOliveira Sep 05 '14 at 11:03
  • 1
    No, it is simply by design of the library. iOS APIs work a similar way. Internally, the library gathers every advertisement and samples its signal strength for distance calculations. You may increase the frequency with which callbacks are made from the library, but it is not recommended. – davidgyoung Sep 05 '14 at 11:36
  • Thank you once again! i will now migrate to the new lib – FOliveira Sep 05 '14 at 13:35
  • I just came across another problem ! After successful change to the new API, i could not detect my 2 raspberry made beacons ! Did the protocol change? The `didRangeBeaconsInRegion` callback is being called but the list is empty! The beacons are running because when i deploy the app with the previous lib they are perfectly detected. – FOliveira Sep 05 '14 at 15:09
  • 1
    By default the new library will only detect intellectual property-free AltBeacon transmissions. But you can easily configure it to detect any proprietary beacon. See instructions here: https://github.com/AltBeacon/android-beacon-library/blob/master/src/main/java/org/altbeacon/beacon/BeaconParser.java#L69 – davidgyoung Sep 05 '14 at 17:47