transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.66k stars 426 forks source link

Configurations are not persisted when changing them via BackgroundGeolocation.setConfig() #2149

Closed Stophface closed 2 months ago

Stophface commented 2 months ago

Expected Behavior

I want to change the configuration of the Plug In after the .ready() method hast been called. I want to to change these two props

BackgroundGeolocation.setConfig({
     startOnBoot: true,
     forceReloadOnBoot: true,
});

Actual Behavior

When I log the configuration with

const state = await BackgroundGeolocation.getState();
console.log(state)

right after I updated the configuration, I see that "startOnBoot": true. However, when I reload the App and I console.log the state where I call the .ready() method, it logs "startOnBoot": false. The Plug ins settings are not persisted? Interestingly, this prop forceReloadOnBoot is not shown in the result of BackgroundGeolocation.getState().

Steps to Reproduce

  1. Change startOnBoot and forceReloadOnBoot to true
  2. Reload the app
  3. Log the plug ins state right after the .ready() method

Context

Change the Plug Ins config.

christocracy commented 2 months ago

See reset: false in Config provided to .ready(config)

Stophface commented 2 months ago

thanks