-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android location saving after restart part 2 #527
Comments
Async-Storage database. App installed, device restarted shortly after opening. 1 location saved.
react-native-background-geolocation database. Same scenario as above with 2 additional locations tracked after restart.
|
I plan on making a few fundamental changes I have discussed with my team, and I want to make sure the solution is agreed upon by key stakeholders. Current Location Tracking:
My proposal:
Future alternative proposal: |
+1 on using data that is already there and more accurate. Will give final decision to @tremblerz but I support this. |
Definitely like the idea of not merging Google's takeout data right away. Especially given that it could come either from Google Places or Google Location history.
|
Unfinished and not tested, but updating this ticket with info on where the work is being done. I'll be done with this ticket by end of day monday. https://github.com/safe-paths-contrib/covid-safe-paths/tree/feature/sqlite-location-tracking |
Safe Paths is not saving locations after device restart until the app is opened. Part 1 of the issue was here: #523. There was a react library bug that prevented the geolocation service from restarting upon a phone reboot.
This issue is for part 2, which is that the Safe Paths geolocation listener no longer exists after a device restart.
Version
Steps to reproduce
Take note of the locations inside RKStorage dataset (async-storage). Restart the application and do not open Safe Paths. No additional locations are logged in RKStorage until Safe Paths opens.
Expected Behavior
When I restart my device, I expect new locations logged in RKStorage before opening Safe Paths application.
Solution
react-native-background-geolocation has its own sqlite database of lat/long/timestamp with additional information. We can set a max row count of 8,064 which is 1 row / every 5 minutes / for 28 days.
We can then get list of locations by calling getLocations (https://github.com/mauron85/react-native-background-geolocation#getlocationssuccess-fail). We can then further filter on timestamp to ensure we only keep 28 days of data in the list.
There is no need to store locations in async-storage. At this point, it is only duplicating data that already exists in the react-native-background-geolocation database. This will be far more efficient, as the current method of adding a location in async-storage involves pulling the entire list of locations, appending a new location in an array, and then re-saving a json blob to sqlite.
The listener will no longer be required to store locations, and can be repurposed just for logging.
The text was updated successfully, but these errors were encountered: