mauron85/cordova-plugin-background-geolocation

I hear debug sound when not in debug mode

Opened this issue · 0 comments

I have installed the plugin. Everything is working but i continue to hear debuggins sounds while I am not in debug mode. Here you are the code used:

BackgroundGeolocation.configure({
    //locationProvider: BackgroundGeolocation.RAW_PROVIDER,
    desiredAccuracy: 0,
    stationaryRadius: 0.01,
    distanceFilter: 0.01,
    startForeground: true,
    notificationTitle: 'Connesso',
    notificationText: 'Sei connesso',
    interval: 10000,
    fastestInterval: 5000,
    activitiesInterval: 10000,
    url: url + '/ws/operatori.php',
    // customize post properties
    postTemplate: {
        codice: codice_centrale,
        token: token,
        op: 'set_posizione',
        lat: '@latitude',
        lon: '@longitude'
    }
  });

  BackgroundGeolocation.on('location', function(location) {
    // handle your locations here
    // to perform long running operation on iOS
    // you need to create background task
    console.log('location');
    BackgroundGeolocation.startTask(function(taskKey) {
        console.log('start task');
      // execute long running task
      // eg. ajax post location
      // IMPORTANT: task has to be ended by endTask
      BackgroundGeolocation.endTask(taskKey);
    });
  });

  BackgroundGeolocation.on('stationary', function(stationaryLocation) {
    // handle stationary locations here
    console.log('stazionario');
  });

  BackgroundGeolocation.on('error', function(error) {
    console.log('[ERROR] BackgroundGeolocation error:', error.code, error.message);
  });

  BackgroundGeolocation.on('start', function() {
    console.log('[INFO] BackgroundGeolocation service has been started');
  });

  BackgroundGeolocation.on('stop', function() {
    console.log('[INFO] BackgroundGeolocation service has been stopped');
  });

  BackgroundGeolocation.on('authorization', function(status) {
    console.log('[INFO] BackgroundGeolocation authorization status: ' + status);
    if (status !== BackgroundGeolocation.AUTHORIZED) {
      // we need to set delay or otherwise alert may not be shown
      setTimeout(function() {
        var showSettings = confirm('L\'applicazione necessita dei permessi di geolocalizzazione per funzionare correttamente. Proseguire?');
        if (showSettings) {
          return BackgroundGeolocation.showAppSettings();
        }
      }, 1000);
    }
  });

  BackgroundGeolocation.on('background', function() {
    console.log('[INFO] App is in background');
    // you can also reconfigure service (changes will be applied immediately)
    BackgroundGeolocation.configure({ debug: true });
  });

  BackgroundGeolocation.on('foreground', function() {
    console.log('[INFO] App is in foreground');
    BackgroundGeolocation.configure({ debug: false });
  });

  BackgroundGeolocation.on('abort_requested', function() {
    console.log('[INFO] Server responded with 285 Updates Not Required');

    // Here we can decide whether we want stop the updates or not.
    // If you've configured the server to return 285, then it means the server does not require further update.
    // So the normal thing to do here would be to `BackgroundGeolocation.stop()`.
    // But you might be counting on it to receive location updates in the UI, so you could just reconfigure and set `url` to null.
  });

  BackgroundGeolocation.on('http_authorization', () => {
    console.log('[INFO] App needs to authorize the http requests');
  });

  BackgroundGeolocation.checkStatus(function(status) {
    console.log('[INFO] BackgroundGeolocation service is running', status.isRunning);
    console.log('[INFO] BackgroundGeolocation services enabled', status.locationServicesEnabled);
    console.log('[INFO] BackgroundGeolocation auth status: ' + status.authorization);

    // you don't need to check status before start (this is just the example)
    if (!status.isRunning) {
      BackgroundGeolocation.start(); //triggers start on start event
    }
  });

Already tried to force debug: false

Your Environment

  • Plugin version: 3.1.0
  • Platform: Android
  • OS version: 10
  • Device manufacturer and model: Dodgee S88Pro
  • Running in Simulator: no
  • Cordova version (cordova -v): 8.1.2
  • Cordova platform version (cordova platform ls): android 7.1.4
  • Plugin configuration options: none
  • Link to your project: -

Context

I have added the plugin with no configuration during installation. I have copy-pasted the example code with some minimal data.

Expected Behavior

The sounds should not be heared.

Actual Behavior

I hear the sounds when movement detected.

Possible Fix

Steps to Reproduce

  1. Start the app
  2. Go in background
  3. I continue to hear sounds but I have not activated the debug

Context

Debug logs