BackgroundGeolocation crashing when executing start()

Hello everyone!

Im trying to track the location of my phone in the background… To do that, Im trying to use @mauron85/cordova-plugin-background-geolocation and @ionic-native/backgroun-geolocation packages.

Here is my App.tsx file:

const App: React.FC = () => {
  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
  };

  BackgroundGeolocation.configure(config).then(() => {
    BackgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe(
      (location: BackgroundGeolocationResponse) => {
        console.log(location);
      }
    );
  });

  BackgroundGeolocation.start();
  return (
    <IonApp>
      <IonReactRouter>
        <IonRouterOutlet>
          <Route path="/login" component={Login} exact={true} />
          <Route path="/home" component={Home} exact={true} />
          <Route exact path="/" render={() => <Redirect to="/login" />} />
        </IonRouterOutlet>
      </IonReactRouter>
    </IonApp>
  );
};

When running my application using capacitor + xcode, the app is crashing and showing this error:
Thread 1: EXC_BAD_ACCESS in CDVBackgroundGeolocation.m

If I re-install the application, the first time I ran it, it works but the second time it crashes.

Does anyone know how to solve this?

Thanks everyone!

Did you find any solution here?