Skip to content

[Help Wanted]: Need help on Distance calculation #1521

@yaswanthsaiaddala

Description

@yaswanthsaiaddala

Required Reading

  • Confirmed

Plugin Version

4.16.9

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Samsung S21

Device operating-systems(s)

Android 15

What do you require assistance about?

I’m noticing some discrepancies in the distance calculation. Do we have any standard or predefined methods for accurately calculating distance?

[Optional] Plugin Code and/or Config

bg.Config(
            url: ENV.TRACKER_HOST, // <-- your server url
            // reset:
            //     false, // <-- lets the Settings screen drive the config rather than re-applying each boot.
            // // Convenience option to automatically configure the SDK to post to Transistor Demo server.
            transistorAuthorizationToken: token,
            // Logging & Debug
            debug: false,
            logLevel: bg.Config.LOG_LEVEL_VERBOSE,
            // Geolocation options
            desiredAccuracy: bg.Config.DESIRED_ACCURACY_NAVIGATION,
            distanceFilter: 10.0,
            // Activity recognition options
            stopTimeout: 5,
            backgroundPermissionRationale: bg.PermissionRationale(
                title:
                    "Allow {applicationName} to access this device's location even when the app is closed or not in use.",
                message:
                    "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
                positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
                negativeAction: 'Cancel'),
            // HTTP & Persistence
            autoSync: true,
            // Application options
            stopOnTerminate: false,
            startOnBoot: true,
            enableHeadless: true,
            heartbeatInterval: 60)

bg.BackgroundGeolocation.setConfig(bg.Config(
          transistorAuthorizationToken: jwt,
          params: {
            "empId": username,
            "token": token,
          },
          desiredOdometerAccuracy: 10,
          disableStopDetection: true,
          maxDaysToPersist: 2,
          forceReloadOnBoot: true,
          allowIdenticalLocations: false,
          locationAuthorizationAlert: {
            'titleWhenNotEnabled': 'Yo, location-services not enabled',
            'titleWhenOff': 'Yo, location-services OFF',
            'instructions':
                'You must enable \'Always\' in location-services, buddy',
            'cancelButton': 'Cancel',
            'settingsButton': 'Settings'
          },
          notification: bg.Notification(
            title: "Sandhya Feed",
            text: "Tracking your location in the background",
          )))

[Optional] Relevant log output

07-04 10:56:10.009  3223  3223 W TSLocationManager: [c.t.f.b.BackgroundGeolocationModule ready] 
07-04 10:56:10.009  3223  3223 W TSLocationManager:   ⚠️  #ready already called.  Redirecting to #setConfig
07-04 10:56:10.016  3223  3349 I TSLocationManager: [c.t.l.http.HttpService flush] 
07-04 10:56:10.016  3223  3349 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:10.016  3223  3349 I TSLocationManager: ║ HTTP Service (count: 0)
07-04 10:56:10.016  3223  3349 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:11.769  3223  3349 I TSLocationManager: [c.t.l.http.HttpService flush] 
07-04 10:56:11.769  3223  3349 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:11.769  3223  3349 I TSLocationManager: ║ HTTP Service (count: 0)
07-04 10:56:11.769  3223  3349 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:11.779  3223  3349 I TSLocationManager: - Enable: false → true, trackingMode: 1
07-04 10:56:11.779  3223  3349 I TSLocationManager: [c.t.l.g.TSGeofenceManager start] 
07-04 10:56:11.779  3223  3349 I TSLocationManager:   🎾  Start monitoring geofences
07-04 10:56:11.789  3223  3349 I TSLocationManager: [c.t.l.s.ActivityRecognitionService start] 
07-04 10:56:11.789  3223  3349 I TSLocationManager:   🎾  Start motion-activity updates
07-04 10:56:11.793  3223  3349 I TSLocationManager: [c.t.l.service.HeartbeatService start] 
07-04 10:56:11.793  3223  3349 I TSLocationManager:   🎾  Start heartbeat (60s)
07-04 10:56:11.794  3223  3349 I TSLocationManager: [c.t.l.s.TSScheduleManager oneShot] 
07-04 10:56:11.794  3223  3349 I TSLocationManager:   ⏰ Scheduled OneShot: HEARTBEAT in 60000ms (jobID: -1307475748)
07-04 10:56:11.797  3223  3349 I TSLocationManager: [c.t.l.service.TrackingService changePace] 
07-04 10:56:11.797  3223  3349 I TSLocationManager:   🔵  setPace: falsefalse
07-04 10:56:11.807  3223  3223 I TSLocationManager: [c.t.l.l.TSLocationManager a] 
07-04 10:56:11.807  3223  3223 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:11.807  3223  3223 I TSLocationManager: ║ motionchange LocationResult: 3 (84928ms old)
07-04 10:56:11.807  3223  3223 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:11.807  3223  3223 I TSLocationManager: ╟─ 📍  Location[fused 17.484051,78.377051 hAcc=12.178 et=+2d23h53m15s697ms alt=531.7999877929688 vAcc=0.63916665 vel=0.133382 sAcc=1.5 bear=110.67838 bAcc=45.0], time: 1751606686879
07-04 10:56:11.819  3223  3349 I TSLocationManager: [c.t.l.l.SingleLocationRequest startUpdatingLocation] 
07-04 10:56:11.819  3223  3349 I TSLocationManager:   🔵  [SingleLocationRequest start, action: 1, requestId: 3]
07-04 10:56:11.839  3223  3349 I TSLocationManager: [c.t.l.s.LocationRequestService b] 
07-04 10:56:11.839  3223  3349 I TSLocationManager:   ℹ️  Location availability: false
07-04 10:56:12.795  3223  3349 I TSLocationManager: [c.t.l.http.HttpService flush] 
07-04 10:56:12.795  3223  3349 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:12.795  3223  3349 I TSLocationManager: ║ HTTP Service (count: 0)
07-04 10:56:12.795  3223  3349 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:13.199  3223  3349 I TSLocationManager: [c.t.l.s.LocationRequestService b] 
07-04 10:56:13.199  3223  3349 I TSLocationManager:   ℹ️  Location availability: true
07-04 10:56:13.208  3223  3349 I TSLocationManager: [c.t.l.l.TSLocationManager a] 
07-04 10:56:13.208  3223  3349 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:13.208  3223  3349 I TSLocationManager: ║ motionchange LocationResult: 3 (102ms old)
07-04 10:56:13.208  3223  3349 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:13.208  3223  3349 I TSLocationManager: ╟─ 📍  Location[fused 17.484047,78.377041 hAcc=11.883 et=+2d23h54m41s923ms alt=531.7999877929688 vAcc=0.63684607], time: 1751606773104
07-04 10:56:13.211  3223  3349 I TSLocationManager: [c.t.l.l.TSLocationManager onSingleLocationResult] 
07-04 10:56:13.211  3223  3349 I TSLocationManager:   🔵  Acquired motionchange position, isMoving: false
07-04 10:56:13.219  3223  4105 I TSLocationManager: [c.t.l.d.s.SQLiteLocationDAO persist] 
07-04 10:56:13.219  3223  4105 I TSLocationManager:   ✅  INSERT: 63e6960d-a128-43c4-aae5-9a7ee5e8bc8f
07-04 10:56:13.224  3223  4105 I TSLocationManager: [c.t.l.http.HttpService flush] 
07-04 10:56:13.224  3223  4105 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:13.224  3223  4105 I TSLocationManager: ║ HTTP Service (count: 1)
07-04 10:56:13.224  3223  4105 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:13.233  3223  3223 I TSLocationManager: [c.t.l.service.TrackingService k] 
07-04 10:56:13.233  3223  3223 I TSLocationManager: ╔═════════════════════════════════════════════
07-04 10:56:13.233  3223  3223 I TSLocationManager: ║ TrackingService motionchange: false
07-04 10:56:13.233  3223  3223 I TSLocationManager: ╠═════════════════════════════════════════════
07-04 10:56:13.278  3223  3223 I TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task start] ⏳ startBackgroundTask: 3
07-04 10:56:13.280  3223  4105 I TSLocationManager: [c.t.l.http.HttpService a] 
07-04 10:56:13.280  3223  4105 I TSLocationManager:   🔵  HTTP POST: 63e6960d-a128-43c4-aae5-9a7ee5e8bc8f
07-04 10:56:14.563  3223  4270 I TSLocationManager: [c.t.l.http.HttpService$f onResponse] 
07-04 10:56:14.563  3223  4270 I TSLocationManager:   🔵  Response: 200
07-04 10:56:14.575  3223  4270 I TSLocationManager: [c.t.l.u.BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions