Skip to content

Commit

Permalink
Added foregroundScanPeriod parameter (+2 squashed commits)
Browse files Browse the repository at this point in the history
Squashed commits:
[8e6fa83] Addd
[0ab3144] Set foreground scan period
  • Loading branch information
olegdeezus authored and petermetz committed Aug 23, 2017
1 parent 4a432e2 commit 4f1d3de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/android/LocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public class LocationManager extends CordovaPlugin implements BeaconConsumer {
public static final String TAG = "com.unarin.beacon";
private static final int PERMISSION_REQUEST_COARSE_LOCATION = 1;
private static final String FOREGROUND_BETWEEN_SCAN_PERIOD_NAME = "com.unarin.cordova.beacon.android.altbeacon.ForegroundBetweenScanPeriod";
private static final String FOREGROUND_SCAN_PERIOD_NAME = "com.unarin.cordova.beacon.android.altbeacon.ForegroundScanPeriod";
private static final int DEFAULT_FOREGROUND_BETWEEN_SCAN_PERIOD = 0;
private static final int DEFAULT_FOREGROUND_SCAN_PERIOD = 200;
private static int CDV_LOCATION_MANAGER_DOM_DELEGATE_TIMEOUT = 30;
private static final int BUILD_VERSION_CODES_M = 23;

Expand Down Expand Up @@ -106,12 +108,15 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {

final int foregroundBetweenScanPeriod = this.preferences.getInteger(
FOREGROUND_BETWEEN_SCAN_PERIOD_NAME, DEFAULT_FOREGROUND_BETWEEN_SCAN_PERIOD);
final int foregroundScanPeriod = this.preferences.getInteger(
FOREGROUND_SCAN_PERIOD_NAME, DEFAULT_FOREGROUND_SCAN_PERIOD);

Log.i(TAG, "Determined config value FOREGROUND_BETWEEN_SCAN_PERIOD: " +
String.valueOf(foregroundBetweenScanPeriod));

iBeaconManager = BeaconManager.getInstanceForApplication(cordovaActivity);
iBeaconManager.setForegroundBetweenScanPeriod(foregroundBetweenScanPeriod);
iBeaconManager.setForegroundScanPeriod(foregroundScanPeriod);

initBluetoothListener();
initEventQueue();
Expand Down

0 comments on commit 4f1d3de

Please sign in to comment.