Skip to content

Commit

Permalink
feat: add config option to request BT permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinHaigh authored and petermetz committed May 14, 2019
1 parent bc6d0c7 commit 1336c1c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/android/LocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public class LocationManager extends CordovaPlugin implements BeaconConsumer {
private static final int DEFAULT_SAMPLE_EXPIRATION_MILLISECOND = 20000;
private static final String ENABLE_ARMA_FILTER_NAME = "com.unarin.cordova.beacon.android.altbeacon.EnableArmaFilter";
private static final boolean DEFAULT_ENABLE_ARMA_FILTER = false;
private static final String REQUEST_BT_PERMISSION_NAME = "com.unarin.cordova.beacon.android.altbeacon.RequestBtPermission";
private static final boolean DEFAULT_REQUEST_BT_PERMISSION = true;
private static final int DEFAULT_FOREGROUND_SCAN_PERIOD = 1100;
private static int CDV_LOCATION_MANAGER_DOM_DELEGATE_TIMEOUT = 30;
private static final int BUILD_VERSION_CODES_M = 23;
Expand Down Expand Up @@ -163,7 +165,11 @@ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
}
//TODO AddObserver when page loaded

tryToRequestMarshmallowLocationPermission();
final boolean requestPermission = this.preferences.getBoolean(
REQUEST_BT_PERMISSION_NAME, DEFAULT_REQUEST_BT_PERMISSION);

if(requestPermission)
tryToRequestMarshmallowLocationPermission();
}

/**
Expand Down

0 comments on commit 1336c1c

Please sign in to comment.