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 ...@@ -92,10 +92,6 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
// Register for events fired by our IntentService "LocationService" // Register for events fired by our IntentService "LocationService"
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
if (isDebugging) {
toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}
} }
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) { public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {
...@@ -132,6 +128,10 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati ...@@ -132,6 +128,10 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
isDebugging = config.getBoolean("debug"); isDebugging = config.getBoolean("debug");
stopOnTerminate = config.getBoolean("stopOnTerminate"); stopOnTerminate = config.getBoolean("stopOnTerminate");
if (isDebugging) {
toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
}
this.callback = callbackContext; this.callback = callbackContext;
} catch (JSONException e) { } catch (JSONException e) {
callbackContext.error("Configuration error " + e.getMessage()); callbackContext.error("Configuration error " + e.getMessage());
...@@ -188,7 +188,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati ...@@ -188,7 +188,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
} }
private void setPace(Boolean moving) { private void setPace(Boolean moving) {
if (isMoving) { if (moving) {
LocationRequest request = LocationRequest.create() LocationRequest request = LocationRequest.create()
.setPriority(translateDesiredAccuracy(desiredAccuracy)) .setPriority(translateDesiredAccuracy(desiredAccuracy))
.setInterval(this.locationUpdateInterval) .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