aranja/rakning-c19-app

maxDaysToPersist setting

Closed this issue · 3 comments

I was looking at this code and I see that maxDaysToPersist isn´t set in the configuration in the tracking.js and I was just writing to double check something.

https://transistorsoft.github.io/react-native-background-geolocation/interfaces/_react_native_background_geolocation_.config.html

This plugin which is the basis for the location tracking says that the default for maxDaysToPersist is 1 day and this link suggests that 'The only way that locations are destroyed from the database are 1 of 4 including' : 'maxDaysToPersist elapses and the location is destroyed.'

https://transistorsoft.github.io/cordova-background-geolocation-lt/interfaces/_cordova_background_geolocation_lt_.httpevent.html

Hopefully I am wrong in this assumption but thought was worth double checking this as I thought the app was supposed to record 14 days worth of locations

If I'm not mistaking you are looking at the wrong documentation.

The package's documentation can be found here https://github.com/mauron85/react-native-background-geolocation.

It looks to store all locations by default with a threshold of 10000 according to maxLocations props and then locations are filtered to get only the last 14 days https://github.com/aranja/rakning-c19-app/blob/master/src/tracking.js#L66

@jeremybarbet is correct. In our calculations, 10.000 should well cover 14 days, since we only get location updates when the user is on the move. We should probably set maxLocations explicitly though.

@eirikurn @jeremybarbet - Yeah, I was looking at the wrong documentation, I had done some playing with this other component before and assumed they were related!

I agree, it would be better to set maxLocations explicitly to make it clearer what´s happening here.