Skip to content

[Help Wanted]: Background location not working properly #1557

@MedhajITTEAM

Description

@MedhajITTEAM

Required Reading

  • Confirmed

Plugin Version

4.13.3

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Redmi 10 prime

Device operating-systems(s)

Android 13

What do you require assistance about?

We have obtained the license[]flutter-geo-location] and implemented the API on our production server. However, we are noticing sudden jumps in map points during trips, which I’ve attached for your reference. Instead of a point based-line, the trips sometimes show zig-zag patterns.

Could you please help us understand why this issue is occurring and guide us on how to resolve it? i have checked your code on github but unable to find any solution.

For your reference, we are using the following code to fetch the user’s current location during a trip:

bg.BackgroundGeolocation.getCurrentPosition(
persist: true,
desiredAccuracy: 40, // <-- desire an accuracy of 40 meters or less
maximumAge: 10000, // <-- Up to 10s old is fine.
timeout: 3000, // <-- wait 30s before giving up.
samples: 1, // <-- sample just 1 location
extras: {"getCurrentPosition": true},
).then((bg.Location location) {
showLog('[getCurrentPosition] - $location');
var param = bg.Config(
reset: true,
debug: false,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
distanceFilter: 5.0,
speedJumpFilter: 50,
autoSyncThreshold: 50,
autoSync: true,
batchSync: true,
maxBatchSize: 100,
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true,
heartbeatInterval: 60,
foregroundService: true,
showsBackgroundLocationIndicator: true,
url: '${AppUrls.baseUrl}uploadLocations',
extras: {
"user_id": userId,
"user_type": userType,
"trip_id": serverTripId.value
},
params: {
"userId": userId,
"userType": userType,
"tripId": serverTripId.value,
"userName": Provider.of(context, listen: false)
.loginModel
.data!
.name
},
locationsOrderDirection: "ASC",
maxDaysToPersist: 1,
backgroundPermissionRationale: bg.PermissionRationale(
title:
"Allow BharatNet to access this device's location when the trip is running.",
message:
"This app collects location data to enable recording your trips to work and calculate distance-travelled.",
positiveAction: "Yes",
negativeAction: "Cancel",
),
[`);```]([url](

Image Image Image

))

[Optional] Plugin Code and/or Config

[Optional] Relevant log output

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