transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
652 stars 240 forks source link

How to disable data deletion after successful sending to the server? #1318

Closed gicha closed 5 months ago

gicha commented 5 months ago

Your Environment

• No issues found!

Expected Behavior

When moving in the background, data is sent to the backend. After running the application I can get these geolocations using BackgroundGeolocation.locations getter

Actual Behavior

Once a geolocation is successfully sent, it is immediately deleted from the database. BackgroundGeolocation.locations returns an empty array

Steps to Reproduce

  1. Run app
  2. Move the app to background
  3. Change a location
  4. Open the app and call BackgroundGeolocation.locations

Context

Debug logs

Logs ``` [c.t.l.d.s.SQLiteLocationDAO persist] I/TSLocationManager(18628): ✅ INSERT: c356d985-1625-4ce4-93e6-8f949c9196ba I/TSLocationManager(18628): [c.t.l.http.HttpService flush] I/TSLocationManager(18628): ╔═════════════════════════════════════════════ I/TSLocationManager(18628): ║ HTTP Service (count: 1) I/TSLocationManager(18628): ╠═════════════════════════════════════════════ I/TSLocationManager(18628): [c.t.l.u.BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 5 D/TSLocationManager(18628): [c.t.l.d.s.SQLiteLocationDAO first] D/TSLocationManager(18628): ✅ Locked 1 records I/TSLocationManager(18628): [c.t.l.http.HttpService a] I/TSLocationManager(18628): 🔵 HTTP POST: c356d985-1625-4ce4-93e6-8f949c9196ba I/TSLocationManager(18628): [c.t.l.http.HttpService$f onResponse] I/TSLocationManager(18628): 🔵 Response: 201 D/TSLocationManager(18628): [c.t.l.d.s.SQLiteLocationDAO destroy] D/TSLocationManager(18628): ✅ DESTROY: c356d985-1625-4ce4-93e6-8f949c9196ba ```
christocracy commented 5 months ago

How to disable data deletion after successful sending to the server?

You can’t. The plug-in desires an empty database. If you want the location in a database, it’s up to you to implement your own SQLite database.