Skip to content
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

Distance is not coming as per actual distance travelled. #1426

Closed
vgirik opened this issue Nov 2, 2023 · 3 comments
Closed

Distance is not coming as per actual distance travelled. #1426

vgirik opened this issue Nov 2, 2023 · 3 comments
Labels

Comments

@vgirik
Copy link

vgirik commented Nov 2, 2023

Your Environment

  • Plugin version: 4.15.2
  • Platform: iOS or Android : Android
  • OS version: 13
  • Device manufacturer / model: Vivo 75
  • Cordova version (cordova -v): 11.0.0
  • Cordova platform version (cordova platform ls): Android 10.1,2
  • Plugin config provided to #ready: Ready
INSERT_YOUR_CODE_HERE

BackgroundGeolocation.watchPosition(
(location) => {
console.log("[watchPosition] -", location);
localStorage.setItem('locations', JSON.stringify(location.coords));
this.lat = location.coords.latitude;
this.lan = location.coords.longitude;
this.odometer = location.odometer
console.log('odometer',this.odometer)
this.data = this.data + this.odometer
console.log('data',this.data)
// localStorage.setItem('odometer',this.data.toString());
this.saveLocation(this.lat, this.lan);
// if ((localStorage.getItem('StopInterval') === 'false' && localStorage.getItem('StopInterval'))) {
// this.store_getCurrentPosition();
// }
},
(errorCode) => {
console.log('[watchPosition] ERROR -', errorCode);
},
{
interval: 7000, // location capture interval
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
persist: true,
timeout: 60000,
}
);

// BackgroundGeolocation Plugin configuration
BackgroundGeolocation.ready(
{
reset: true,
// debug: true,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
//autoSync: true,
stopOnTerminate: false,
allowIdenticalLocations: false,
persistMode: BackgroundGeolocation.PERSIST_MODE_LOCATION,
},
(state) => {
console.log('[ready] BackgroundGeolocation is ready to use');
if (!state.enabled) {
BackgroundGeolocation.start();
}
}
);
}

Expected Behavior

Actual KMS : 5 KM

Actual Behavior

In one trip it came 58 kms
In another trip it came 20 Kms

Steps to Reproduce

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

Please learn to Syntax highlight codeblocks.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Apr 17, 2024
Copy link

github-actions bot commented May 1, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants