christocracy / cordova-plugin-background-geolocation

Sophisticated, battery-conscious, cross-platform background-geolocation with motion-detection
http://transistorsoft.github.io/cordova-background-geolocation
492 stars 743 forks source link

Plugin posting old location with the updated location #232

Closed itstyro closed 8 years ago

itstyro commented 8 years ago

Hi Chris,

Thank you for serving million people with this great plugin.

Chris, i'm using this plugin on android device and i've set the locationTimeout property to be 5 minutes. locationTimeout:300 // 5 minutes But whenever plugin posts the location data after 5 minutes. it makes 3 consecutive post request to the server and it is sending the old location with the updated one. I just need to get only the updated location.

Please do the possible.

Thank you, Munish

parmod-arora commented 8 years ago

I also found this issue in android.

Please check if you resolved the issue with this commit

https://github.com/parmod-arora/cordova-plugin-background-geolocation/commit/3f56a9eaf73e2fe9da1f23ff17b8f325e93a34c4

https://github.com/christocracy/cordova-plugin-background-geolocation/pull/235

christocracy commented 8 years ago

That commit looks naive and dangerous to me. Simply deleting all locations in cache after a single successful POST?? What if the user was simply had no cell-service for a time (say 1 hour) and the plugin kept recording GPS locations? When he comes back online, the plugin is going to attempt to sync each saved location to the server, one-by-one, deleting only when the server returns http 200.

I'm not going to merge that. Are you sure your server is return HTTP status 200?

Are you monitoring adb log? The plugin logs the HTTP response status it receives from server.

$ adb logcat -s LocationUpdateService
`