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

Inaccurate Geolocation Tracking: Points Show Straight Lines Instead of Correct Path #306

Open
rafaelcaniello opened this issue Feb 5, 2025 · 1 comment

Comments

@rafaelcaniello
Copy link

Description:
I am facing issues while using the capacitor-background-geolocation library in my Ionic application. The problem occurs frequently and manifests as follows:

  • The recorded geolocation points are distant from each other, drawing straight lines on the map instead of following the actual path taken.
  • This behavior directly impacts the user experience and compromises the accuracy of the recorded data.

Tested Configurations:
I tried adjusting several configurations to solve the issue, but without success:

  • Adjustment of desiredAccuracy
  • Modification of distanceFilter and locationUpdateInterval
  • Tests with different values for stationaryRadius

Despite these changes, the points are still being recorded inconsistently.

Environment:

  • Capacitor Version: [6.0.1]
  • Plugin Version: [6.0.3]
  • Device OS: [Android]
  • Device Model: [add device model]
  • Ionic Framework Version: [7.2.0]

Steps to Reproduce:

  1. Start geolocation tracking on an urban route with multiple curves.
  2. Monitor the map in real-time or review the stored data.
  3. Notice that the recorded points form straight lines instead of following the actual path.

Expected Behavior:
Geolocation points should be recorded accurately, following the path taken by the user.

Current Behavior:

  1. Delays in starting location capture after the device starts moving.
  2. Intermittent tracking, causing large distances between location points.

Logs and Evidence:

Configuration used:

distanceFilter: 10,
stationaryRadius: 200,
locationTimeout: 15,
disableElasticity: false,
isMoving: true,
stopTimeout: 5,
disableStopDetection: false,
stopOnStationary: false,
stopOnTerminate: false,
url: environment.locations.address,
method: 'POST',
headers: { 'x-access-token': authenticatedUser.token },
params: { device: deviceUuid },
maxDaysToPersist: 1,
startOnBoot: true,
heartbeatInterval: 60,
logMaxDays: 1,
useSignificantChangesOnly: false,
locationAuthorizationRequest: 'Always',
disableMotionActivityUpdates: false,
preventSuspend: true,
fastestLocationUpdateInterval: 5000,
deferTime: 0,
allowIdenticalLocations: true,
enableHeadless: true,
foregroundService: true,
locationUpdateInterval: 5000

Log:

Images

Suggestion:
What would be the ideal configuration to avoid this behavior? Is there any additional parameter that can help capture points more accurately in urban environments?

@christocracy
Copy link
Member

The plug-in takes at least 200 meters of movement before the device is detected to be moving (can take longer depending on environment). This results in essentially a straight line from the last know “stationary location” to the point where the plug-in toggled into the “moving state”.

See api docs Config.stationaryRadius for more information and images explaining this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants