Native BackgroundGeolocation Plugin_Not_Installed


#1

Hi

I’m following the Ionic Native tutorial for BackgroundGeolocation https://ionicframework.com/docs/native/background-geolocation/ .

I’ve got this bit of code in my location provider’s constructor:

const config: BackgroundGeolocationConfig = {
      desiredAccuracy: 10,
      stationaryRadius: 20,
      distanceFilter: 30,
      debug: true, //  enable this hear sounds for background-geolocation life-cycle.
      stopOnTerminate: false, // enable this to clear background location settings when the app terminates
    };

this.backgroundGeolocation.configure(config)
      .subscribe((location: BackgroundGeolocationResponse) => {
        alert(`lat: ${location.latitude}, lon: ${location.longitude}`);
        //console.log(location);

        // IMPORTANT:  You must execute the finish method here to inform the native plugin that you're finished,
        // and the background-task may be completed.  You must do this regardless if your HTTP request is successful or not.
        // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
        //this.backgroundGeolocation.finish(); // FOR IOS ONLY

      }, err => {
        alert(err);
      });

The err => {…} returns a “Plugin_Not_Installed” alert in Ionic View.

My package.json contains:

...,
"@ionic-native/background-geolocation": "^4.3.0",
"@ionic-native/core": "^4.3.0",
...,
"cordova-plugin-mauron85-background-geolocation": "~2.2.5",
...

I’ve tried putting the code inside a platform.ready().then(() => {…} but that didn’t do anything.

Any suggestions how to fix this would be appreciated.

Thanks