Skip to content Skip to sidebar Skip to footer

Looping On Beacons

@Override public void onBeaconServiceConnect() { BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this); beaconManager.setRangeNotifier(new RangeNotifi

Solution 1:

I often use a BeaconTracker singleton class in apps where I want to keep track of the last distance seen to each beacon. You can see an example of this here:

https://github.com/davidgyoung/ningo-android/blob/master/app/src/main/java/com/davidgyoungtech/beaconscanner/BeaconTracker.java

You can use this class by calling it from your didRangeBeaconsInRegion(...) callback like this:

BeaconTracker.getInstance(context).updateTrackedBeacons(beacons);

You can then access the tracked beacons later to compare distance with:

List<TrackedBeacon> trackedBeacons = BeaconTracker.getInstance(context).getTrackedBeacons();

Post a Comment for "Looping On Beacons"