react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Destroying all the coordinates in the local database when doing stop()

Open Kranysys opened this issue 7 years ago • 6 comments

Your Environment

  • Plugin version: 3.2.0
  • Platform: Android
  • OS version: 9.0
  • Device manufacturer / model: Nokia 7.1
  • React Native version (react-native -v): 0.60.4
  • Plugin config
  reset: true,
  desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  disableElasticity: true,
  distanceFilter: 0,
  locationUpdateInterval: 1000,
  stopTimeout: 1,
  debug: true,
  logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
  stopOnTerminate: false,
  startOnBoot: true,
  autoSync: true,
  batchSync: false,
  autoSyncThreshold: 0,

Expected Behavior

Destroying all the coordinates in the local database (remaining coordinates not sent due to error, or whatever) when doing BackgroundGeolocation.stop()

Actual Behavior

When we do stop(), the coordinates still in the database, and when we start again with start(), the old coordinates are sent (maybe due to timeout error, with some coordinates). We do not want this, we want a new clean database with only the new points. We tried to use destoy all in the DB with destroyLocations() after stop(), but it doesn't seems to work.

Steps to Reproduce

BackgroundGeolocation.stop(() =>
            BackgroundGeolocation.setConfig({ url: '' }, (state: any) => {
              console.log('state after stop and set url ::', state);
              ToastAndroid.show('BackgroundLocation -> STOP!', ToastAndroid.LONG);
            }),
          );
BackgroundGeolocation.destroyLocations();

Context

Clean the database if the background geolocation is not started/stopped.

Kranysys avatar Oct 27 '19 17:10 Kranysys

The only that destroys locations from the database are:

  • http 200 response from your server.
  • manually executing #destroyLocations

There is absolutely no possible way locations get destroyed any other way.

christocracy avatar Oct 27 '19 20:10 christocracy

Thank you @christocracy for this precious information. Do you know if there is a way to access the SQLite content in real time ? Just to be sure the coordinates are removed.

Kranysys avatar Oct 28 '19 08:10 Kranysys

#getCount will show the number of records in database.

On Mon, Oct 28, 2019 at 4:30 AM Nicolas BAPTISTA [email protected] wrote:

Thank you @christocracy https://github.com/christocracy for this precious information. Do you know if there is a way to access the SQLite content in real time ? Just to be sure the coordinates are removed.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/transistorsoft/react-native-background-geolocation/issues/886?email_source=notifications&email_token=AAADVF3MSYNHCVYCFHGB36DQQ2PLFA5CNFSM4JFSW5KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECMCQMI#issuecomment-546842673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVFY23YRGCNRCHBPLAGDQQ2PLFANCNFSM4JFSW5KA .

-- Snet form Gmail Mobile

christocracy avatar Oct 28 '19 11:10 christocracy

@christocracy Sorry to resurrect but can you please clarify/confirm the following.

If you never call sync or destroyLocations the SQLLite database will indefinitely be storing and adding locations ballooning your app footprint?

Thanks

dorthwein avatar Dec 13 '19 17:12 dorthwein

@dorthwein Until Config.maxDaysToPersist, when they'll be automatically destroyed.

christocracy avatar Dec 13 '19 17:12 christocracy

Great thanks

dorthwein avatar Dec 13 '19 17:12 dorthwein