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

Locations are reported infrequently #167

Open
jwasnoggin opened this issue Nov 3, 2023 · 3 comments
Open

Locations are reported infrequently #167

jwasnoggin opened this issue Nov 3, 2023 · 3 comments

Comments

@jwasnoggin
Copy link

Describe the bug
Using this plugin in my app, locations are being recorded much less frequently than I expect. I have interval set to 60000 (1 minute), and stationaryRadius and distanceFilter set to 10. I would expect an update close to every minute, but instead it was only happening every 3-10 minutes typically. Sometimes if I opened Google Maps it would then send a location (I guess because the GPS was activated), but not always.

Is there any way I can set an expected frequency and have the app honour that?

My full config:

{
    locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
    desiredAccuracy: BackgroundGeolocation.MEDIUM_ACCURACY,
    stationaryRadius: 10,
    distanceFilter: 10,
    stopOnTerminate: false,
    notificationTitle: 'Background tracking',
    notificationText: 'enabled',
    debug: false,
    interval: frequencySeconds * 1000,
    startForeground: true,
    pauseLocationUpdates: false,
    saveBatteryOnBackground: false,
    maxLocations: 1000,
    url,
    syncUrl,
    httpHeaders,
    postTemplate
}

Expected behavior
The app should report a location every minute (as long as the speed is less than 60 m/s).

Smartphone:

  • Device: Huawei P20 Pro
  • OS: Android 10 (EMUI 12)
@HarelM
Copy link
Collaborator

HarelM commented Nov 3, 2023

I would consult the plugin's logs to see what might have caused this, also I would recommend trying all kind of configurations.
If nothing helps feel free to add prints in the code.
The plugin mainly send back what the OS sends it...

@jwasnoggin
Copy link
Author

I had a look at the logs, doesn't seem to be any errors. There are a few gaps where nothing happens for several minutes, for example here between 17:36 and 17:45. The tracking was supposedly running the whole time.

[2023/10/27 17:45:03] com.marianhello.bgloc.PostLocationTask:Posting json to url: <REDACTED>
[2023/10/27 17:45:03] com.marianhello.bgloc.BackgroundGeolocationFacade:Received MSG_ON_LOCATION
[2023/10/27 17:45:03] com.marianhello.bgloc.PostLocationTask:Executing PostLocationTask#postLocation
[2023/10/27 17:45:03] com.marianhello.bgloc.service.LocationServiceImpl:New location BGLocation[gps <REDACTED>,<REDACTED> id=null acc=128 t=1698389101912 et=+24d23h42m30s40ms alt=49.660953606481414 vel=25.021564 bear=0.0 {Bundle[mParcelledData.dataSize=132]} locprov=0]
[2023/10/27 17:45:03] com.marianhello.bgloc.provider.DistanceFilterLocationProvider:Requesting location updates from provider gps
[2023/10/27 17:45:03] com.marianhello.bgloc.provider.DistanceFilterLocationProvider:Setting pace: true
[2023/10/27 17:45:03] com.marianhello.bgloc.provider.DistanceFilterLocationProvider:Updating distanceFilter: new=635 old=235
[2023/10/27 17:45:03] com.marianhello.bgloc.provider.DistanceFilterLocationProvider:Location change: Location[gps <REDACTED>,<REDACTED> hAcc=128 et=+24d23h42m30s40ms alt=49.660953606481414 vel=25.021564 bear=0.0 vAcc=128 sAcc=0 bAcc=5 {Bundle[mParcelledData.dataSize=132]}] isMoving=true
[2023/10/27 17:38:34] com.marianhello.bgloc.service.LocationServiceImpl:Network condition changed has connectivity: true
[2023/10/27 17:38:12] com.marianhello.bgloc.service.LocationServiceImpl:Network condition changed has connectivity: false
[2023/10/27 17:36:14] com.marianhello.bgloc.PostLocationTask:Posting json to url: <REDACTED>
[2023/10/27 17:36:14] com.marianhello.bgloc.BackgroundGeolocationFacade:Received MSG_ON_LOCATION
[2023/10/27 17:36:14] com.marianhello.bgloc.PostLocationTask:Executing PostLocationTask#postLocation
[2023/10/27 17:36:14] com.marianhello.bgloc.service.LocationServiceImpl:New location BGLocation[gps <REDACTED>,<REDACTED> id=null acc=96 t=1698388572982 et=+24d23h33m41s137ms alt=82.85539544211348 vel=15.107342 bear=0.0 {Bundle[mParcelledData.dataSize=132]} locprov=0]
[2023/10/27 17:36:14] com.marianhello.bgloc.provider.DistanceFilterLocationProvider:Location change: Location[gps <REDACTED>,<REDACTED> hAcc=96 et=+24d23h33m41s137ms

@HarelM
Copy link
Collaborator

HarelM commented Nov 3, 2023

It might be related to distance? You also have medium accuracy which might be affecting somehow, IDK, it's complicated...
Adding logs to the java code might help I guess...

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