From 4f1d3defee66b259aeaad3b631a1915e58af0f00 Mon Sep 17 00:00:00 2001 From: Oleg Dizus Date: Fri, 20 May 2016 11:28:37 +0300 Subject: [PATCH] Added foregroundScanPeriod parameter (+2 squashed commits) Squashed commits: [8e6fa83] Addd [0ab3144] Set foreground scan period --- src/android/LocationManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/android/LocationManager.java b/src/android/LocationManager.java index 9f825fb..3f633d9 100644 --- a/src/android/LocationManager.java +++ b/src/android/LocationManager.java @@ -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; @@ -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();