This commit is contained in:
PavelRatushny 2017-08-30 19:00:25 +03:00
parent 2f8a514d4f
commit c97595ccc3
3 changed files with 43 additions and 0 deletions

View file

@ -77,4 +77,7 @@ interface IOsmAndAidlInterface {
boolean removeFavorite(in RemoveFavoriteParams params);
boolean updateFavorite(in UpdateFavoriteParams params);
boolean startGpxRecording();
boolean stopGpxRecording();
}

View file

@ -29,9 +29,11 @@ import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.views.AidlMapLayer;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer;
@ -841,4 +843,24 @@ public class OsmandAidlApi {
app.sendBroadcast(intent);
return true;
}
boolean startGpxRecording() {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.startGPXMonitoring(null);
plugin.updateControl();
return true;
}
return false;
}
boolean stopGpxRecording() {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.stopRecording();
plugin.updateControl();
return true;
}
return false;
}
}

View file

@ -320,5 +320,23 @@ public class OsmandAidlService extends Service {
return true;
}
}
@Override
public boolean startGpxRecording() throws RemoteException {
try {
return getApi().startGpxRecording();
} catch (Exception e) {
return false;
}
}
@Override
public boolean stopGpxRecording() throws RemoteException {
try {
return getApi().stopGpxRecording();
} catch (Exception e) {
return false;
}
}
};
}