Commit 3a09facb authored by Chris Scott's avatar Chris Scott

Wrong config param name notifyOnEnter vs notifyOnEntry. Add error-checking to...

Wrong config param name notifyOnEnter vs notifyOnEntry.  Add error-checking to JS api addGeofence:  enforce has set either notifyOnEntry OR notifyOnExit
parent c5e439c0
......@@ -31,6 +31,7 @@ public class CDVBackgroundGeolocation extends CordovaPlugin {
public static final String ACTION_START = "start";
public static final String ACTION_STOP = "stop";
public static final String ACTION_FINISH = "finish";
public static final String ACTION_ON_PACE_CHANGE = "onPaceChange";
public static final String ACTION_CONFIGURE = "configure";
public static final String ACTION_SET_CONFIG = "setConfig";
......@@ -88,9 +89,13 @@ public class CDVBackgroundGeolocation extends CordovaPlugin {
this.setEnabled(true);
callbackContext.success();
} else if (ACTION_STOP.equalsIgnoreCase(action)) {
// No implementation to stop background-tasks with Android. Just say "success"
result = true;
this.setEnabled(false);
callbackContext.success();
} else if (ACTION_FINISH.equalsIgnoreCase(action)) {
result = true;
callbackContext.success();
} else if (ACTION_CONFIGURE.equalsIgnoreCase(action)) {
result = applyConfig(data);
if (result) {
......@@ -166,8 +171,8 @@ public class CDVBackgroundGeolocation extends CordovaPlugin {
event.putDouble("latitude", config.getDouble("latitude"));
event.putDouble("longitude", config.getDouble("longitude"));
event.putString("identifier", config.getString("identifier"));
if (config.has("notifyOnEnter")) {
event.putBoolean("notifyOnEnter", config.getBoolean("notifyOnEnter"));
if (config.has("notifyOnEntry")) {
event.putBoolean("notifyOnEntry", config.getBoolean("notifyOnEntry"));
}
if (config.has("notifyOnExit")) {
event.putBoolean("notifyOnExit", config.getBoolean("notifyOnExit"));
......
......@@ -184,6 +184,9 @@ module.exports = {
if (!config.radius) {
throw "#addGeofence requires a #radius";
}
if ( (typeof(config.notifyOnEnter) === 'undefined') && (typeof(config.notifyOnExit) === 'undefined') ) {
throw "#addGeofence requires at least notifyOnEnter {Boolean} and/or #notifyOnExit {Boolean}";
}
exec(success || function() {},
failure || function() {},
'BackgroundGeoLocation',
......
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