diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java index 64ed3acfcb..4cc790d587 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java @@ -92,6 +92,8 @@ public class ExternalApiHelper { public static final String API_CMD_START_GPX_REC = "start_gpx_rec"; public static final String API_CMD_STOP_GPX_REC = "stop_gpx_rec"; + public static final String API_CMD_SAVE_GPX = "save_gpx"; + public static final String API_CMD_CLEAR_GPX = "clear_gpx"; public static final String API_CMD_SUBSCRIBE_VOICE_NOTIFICATIONS = "subscribe_voice_notifications"; public static final int VERSION_CODE = 1; @@ -550,6 +552,30 @@ public class ExternalApiHelper { plugin.stopRecording(); } + if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) { + finish = true; + } + resultCode = Activity.RESULT_OK; + } else if (API_CMD_SAVE_GPX.equals(cmd)) { + OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); + if (plugin == null) { + resultCode = RESULT_CODE_ERROR_PLUGIN_INACTIVE; + finish = true; + } else { + plugin.saveCurrentTrack(); + } + if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) { + finish = true; + } + resultCode = Activity.RESULT_OK; + } else if (API_CMD_CLEAR_GPX.equals(cmd)) { + OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class); + if (plugin == null) { + resultCode = RESULT_CODE_ERROR_PLUGIN_INACTIVE; + finish = true; + } else { + app.getSavingTrackHelper().clearRecordedData(true); + } if (uri.getBooleanQueryParameter(PARAM_CLOSE_AFTER_COMMAND, true)) { finish = true; }