Commit 2bc77307 authored by Chris Scott's avatar Chris Scott

Wait until configure before instantiating ToneGenerator

parent 1af4f38b
......@@ -92,10 +92,6 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
// Register for events fired by our IntentService "LocationService"
EventBus.getDefault().register(this);
if (isDebugging) {
toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}
}
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {
......@@ -132,6 +128,10 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
isDebugging = config.getBoolean("debug");
stopOnTerminate = config.getBoolean("stopOnTerminate");
if (isDebugging) {
toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}
this.callback = callbackContext;
} catch (JSONException e) {
callbackContext.error("Configuration error " + e.getMessage());
......@@ -188,7 +188,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
}
private void setPace(Boolean moving) {
if (isMoving) {
if (moving) {
LocationRequest request = LocationRequest.create()
.setPriority(translateDesiredAccuracy(desiredAccuracy))
.setInterval(this.locationUpdateInterval)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment