-
Notifications
You must be signed in to change notification settings - Fork 664
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
Emit position event only by the time that a distance change was made - not automatically after 5 seconds #162
Comments
Just posting some relevant information for this feature request. Currently not configurable but this is already done on iOS. Note cordova-plugin-geolocation/src/ios/CDVLocation.m Lines 140 to 151 in 6be29f2
As for Android, this plugin uses the webview geolocation implementation, which doesn't have a configurable distance filter as far as I can tell. In order to accomplish this, I think the plugin will to use the android location manager directly instead of relying on the browser implementation. |
Thanks for your reply.
Is this the proper way? ** For Android, when will this be available, is there any roadmap for doing so? |
The plugin has the value hard coded to be 5 meters when high accuracy is enabled, or 10 meters otherwise.
Sorry, I'm not the person that can answer that question. Obviously moving from the browser implementation to a custom implementation that uses Android's geolocation APIs directly is a significant change... |
For the record, I'm having a quick scan through Android Location documentation and it doesn't look like they have a distance filter concept either. Their battery saving recommendations makes no mention of a distance filter and their API reference seems to lack a distance filter setting. So I'm not sure if this is even possible on Android. Distance filter might be an iOS concept only. Personally I think the distanceFilter for iOS should be configurable. The defaults can be left as is if not explicitly set by the app. For android, the API/config properties would have to be ignored as Android seems to have a different philosophy on achieving conservative battery status when using geolocation. |
I agree on letting your users choose how they want the library to work, not forcing them to make changes to your code if they need higher accuracy than 5m changes. At the least this should be documented. I also found evidence that distanceFilter has no direct impact on battery life at https://stackoverflow.com/questions/5490707/does-cllocationmanager-distancefilter-do-anything-to-conserve-power |
Feature Request
Motivation Behind Feature
This is a must have feature. Save battery consuming, report about position changes to API only when there a significant change - instead of every 5 seconds.
Feature Description
The watchPosition method emits the success callback after every 5 seconds (if there no errors). This is bad. It has to emit the event only when the user actually moves - in order to save battery and report to remote APIs only when needed.
Alternatives or Workarounds
I am using some wrapper of the service, only when there some significant distance between previous position that was saved I send it to the DB.
I defined by my own the minimal distance in meters in order to consider a change.
This is not a good way of working. This plugin should emit only when there was a change in position and it should be setted for what is change in position or not.
The text was updated successfully, but these errors were encountered: