Search in sources :

Example 6 with OsmandMonitoringPlugin

use of net.osmand.plus.monitoring.OsmandMonitoringPlugin in project Osmand by osmandapp.

the class GpxNotification method init.

@Override
public void init() {
    app.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
            if (plugin != null) {
                plugin.saveCurrentTrack();
                if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) {
                    plugin.stopRecording();
                }
            }
        }
    }, new IntentFilter(OSMAND_SAVE_GPX_SERVICE_ACTION));
    app.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
            if (plugin != null) {
                plugin.startGPXMonitoring(null);
                plugin.updateControl();
            }
        }
    }, new IntentFilter(OSMAND_START_GPX_SERVICE_ACTION));
    app.registerReceiver(new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
            if (plugin != null) {
                plugin.stopRecording();
                plugin.updateControl();
            }
        }
    }, new IntentFilter(OSMAND_STOP_GPX_SERVICE_ACTION));
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) BroadcastReceiver(android.content.BroadcastReceiver) OsmandMonitoringPlugin(net.osmand.plus.monitoring.OsmandMonitoringPlugin)

Example 7 with OsmandMonitoringPlugin

use of net.osmand.plus.monitoring.OsmandMonitoringPlugin in project Osmand by osmandapp.

the class OsmandPlugin method initPlugins.

public static void initPlugins(OsmandApplication app) {
    OsmandSettings settings = app.getSettings();
    Set<String> enabledPlugins = settings.getEnabledPlugins();
    allPlugins.add(new MapillaryPlugin(app));
    enabledPlugins.add(MapillaryPlugin.ID);
    allPlugins.add(new OsmandRasterMapsPlugin(app));
    allPlugins.add(new OsmandMonitoringPlugin(app));
    checkMarketPlugin(app, new SRTMPlugin(app), true, SRTM_PLUGIN_COMPONENT_PAID, SRTM_PLUGIN_COMPONENT);
    // ? questionable - definitely not market plugin
    // checkMarketPlugin(app, new TouringViewPlugin(app), false, TouringViewPlugin.COMPONENT, null);
    checkMarketPlugin(app, new NauticalMapsPlugin(app), false, NauticalMapsPlugin.COMPONENT, null);
    checkMarketPlugin(app, new SkiMapsPlugin(app), false, SkiMapsPlugin.COMPONENT, null);
    allPlugins.add(new AudioVideoNotesPlugin(app));
    checkMarketPlugin(app, new ParkingPositionPlugin(app), false, ParkingPositionPlugin.PARKING_PLUGIN_COMPONENT, null);
    allPlugins.add(new AccessibilityPlugin(app));
    allPlugins.add(new OsmEditingPlugin(app));
    allPlugins.add(new OsmandDevelopmentPlugin(app));
    activatePlugins(app, enabledPlugins);
}
Also used : SRTMPlugin(net.osmand.plus.srtmplugin.SRTMPlugin) AudioVideoNotesPlugin(net.osmand.plus.audionotes.AudioVideoNotesPlugin) OsmandMonitoringPlugin(net.osmand.plus.monitoring.OsmandMonitoringPlugin) MapillaryPlugin(net.osmand.plus.mapillary.MapillaryPlugin) OsmEditingPlugin(net.osmand.plus.osmedit.OsmEditingPlugin) SkiMapsPlugin(net.osmand.plus.skimapsplugin.SkiMapsPlugin) ParkingPositionPlugin(net.osmand.plus.parkingpoint.ParkingPositionPlugin) OsmandDevelopmentPlugin(net.osmand.plus.development.OsmandDevelopmentPlugin) NauticalMapsPlugin(net.osmand.plus.openseamapsplugin.NauticalMapsPlugin) AccessibilityPlugin(net.osmand.access.AccessibilityPlugin) OsmandRasterMapsPlugin(net.osmand.plus.rastermaps.OsmandRasterMapsPlugin)

Aggregations

OsmandMonitoringPlugin (net.osmand.plus.monitoring.OsmandMonitoringPlugin)7 Intent (android.content.Intent)3 DialogInterface (android.content.DialogInterface)2 AlertDialog (android.support.v7.app.AlertDialog)2 View (android.view.View)2 Button (android.widget.Button)2 CheckBox (android.widget.CheckBox)2 CompoundButton (android.widget.CompoundButton)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 File (java.io.File)2 GPXFile (net.osmand.plus.GPXUtilities.GPXFile)2 OsmandApplication (net.osmand.plus.OsmandApplication)2 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 IntentFilter (android.content.IntentFilter)1 Uri (android.net.Uri)1