@Override
public void onBeaconServiceConnect() {
BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.setRangeNotifier(new
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 trackedBeacons = BeaconTracker.getInstance(context).getTrackedBeacons();