Skip to content

Commit

Permalink
Remove incorrect override of distance calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgyoung committed Apr 13, 2024
1 parent 83a9d90 commit f80aafd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ public void onCreate() {

mScanHelper.reloadParsers();

DistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(this, BeaconManager.getDistanceModelUpdateUrl());
Beacon.setDistanceCalculator(defaultDistanceCalculator);
if (Beacon.getDistanceCalculator() == null) {
DistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(this, BeaconManager.getDistanceModelUpdateUrl());
Beacon.setDistanceCalculator(defaultDistanceCalculator);
}

// Look for simulated scan data
try {
Expand Down
7 changes: 5 additions & 2 deletions lib/src/main/java/org/altbeacon/beacon/service/ScanJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BuildConfig;
import org.altbeacon.beacon.Region;
import org.altbeacon.beacon.distance.DistanceCalculator;
import org.altbeacon.beacon.distance.ModelSpecificDistanceCalculator;
import org.altbeacon.beacon.logging.LogManager;
import org.altbeacon.beacon.utils.ProcessUtils;
Expand Down Expand Up @@ -326,8 +327,10 @@ private boolean startScanning() {
ProcessUtils processUtils = new ProcessUtils(ScanJob.this);
LogManager.i(TAG, "beaconScanJob PID is "+processUtils.getPid()+" with process name "+processUtils.getProcessName());
}
ModelSpecificDistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(ScanJob.this, BeaconManager.getDistanceModelUpdateUrl());
Beacon.setDistanceCalculator(defaultDistanceCalculator);
if (Beacon.getDistanceCalculator() == null) {
DistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(this, BeaconManager.getDistanceModelUpdateUrl());
Beacon.setDistanceCalculator(defaultDistanceCalculator);
}
return restartScanning();
}

Expand Down

0 comments on commit f80aafd

Please sign in to comment.