mauron85/cordova-plugin-background-geolocation

GPS .on('location') callback only hits once on RAW_PROVIDER and DISTANCE_PROVIDER providers.

Closed this issue · 4 comments

Your Environment

  • Plugin version: 3.1.0
  • Platform: Android
  • OS version: Android 10
  • Device manufacturer and model: Oneplus 6

Context


My configuration: 

BackgroundGeolocation.configure({
               locationProvider: BackgroundGeolocation.RAW_PROVIDER, 
               desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
               notificationTitle: 'LAF\xAE Collect',
               notificationText: 'This app is tracking location on background.',
               debug: true,
               interval: 5000,
               stopOnTerminate: false,
               notificationsEnabled: true,
               startForeground: true,
               url: '',
               stopOnStillActivity: false
           });

Expected Behavior

BackgroundGeolocation.on('location', function (location) { });

The above callback should be called with location updates every 5 second interval when using RAW_PROVIDER.

Actual Behavior

BackgroundGeolocation.on('location', function (location) { });

The above callback only hits once after starting using BackgroundGeolocation.start(); when using RAW_PROVIDER.

Possible Fix

Steps to Reproduce

  1. Start Scan with Configuration set provider as RAW_PROVIDER
  2. First location update is there
  3. Wait, further no updates received, tried roaming around the house.

Context

Debug logs

2020-06-03 16:21:07.556 27823-27823/io.cordova.lafcollect I/Surface: opservice is null false
2020-06-03 16:21:07.581 27823-27922/io.cordova.lafcollect D/com.marianhello.bgloc.data.sqlite.SQLiteConfigurationDAO: Configuration persisted with rowId = 1
2020-06-03 16:21:07.582 27823-27922/io.cordova.lafcollect D/com.marianhello.bgloc.BackgroundGeolocationFacade: Service configured with: Config[distanceFilter=500 stationaryRadius=50.0 desiredAccuracy=0 interval=5000 fastestInterval=120000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true notificationsEnabled=true locationProvider=2 nTitle=LAF® Collect nText=This app is tracking location on background. nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate=null]
2020-06-03 16:21:07.582 27823-27823/io.cordova.lafcollect D/SystemWebChromeClient: file:///android_asset/www/js/controllers/HomeController.js: Line 289 : [INFO] BackgroundGeolocation service is running false
2020-06-03 16:21:07.583 27823-27823/io.cordova.lafcollect I/chromium: [INFO:CONSOLE(289)] "[INFO] BackgroundGeolocation service is running false", source: file:///android_asset/www/js/controllers/HomeController.js (289)
2020-06-03 16:21:07.583 27823-27823/io.cordova.lafcollect D/SystemWebChromeClient: file:///android_asset/www/js/controllers/HomeController.js: Line 290 : [INFO] BackgroundGeolocation services enabled true
2020-06-03 16:21:07.583 27823-27823/io.cordova.lafcollect I/chromium: [INFO:CONSOLE(290)] "[INFO] BackgroundGeolocation services enabled true", source: file:///android_asset/www/js/controllers/HomeController.js (290)
2020-06-03 16:21:07.584 27823-27823/io.cordova.lafcollect D/SystemWebChromeClient: file:///android_asset/www/js/controllers/HomeController.js: Line 291 : [INFO] BackgroundGeolocation auth status: 1
2020-06-03 16:21:07.584 27823-27823/io.cordova.lafcollect I/chromium: [INFO:CONSOLE(291)] "[INFO] BackgroundGeolocation auth status: 1", source: file:///android_asset/www/js/controllers/HomeController.js (291)
2020-06-03 16:21:07.584 27823-27966/io.cordova.lafcollect D/com.marianhello.bgloc.BackgroundGeolocationFacade: Starting service
2020-06-03 16:21:07.601 27823-27966/io.cordova.lafcollect I/com.marianhello.bgloc.BackgroundGeolocationFacade: User granted requested permissions
2020-06-03 16:21:07.611 27823-27966/io.cordova.lafcollect I/com.marianhello.bgloc.BackgroundGeolocationFacade: Attempt to start bg service
2020-06-03 16:21:07.624 27823-27823/io.cordova.lafcollect I/com.marianhello.bgloc.service.LocationServiceImpl: Creating LocationServiceImpl
2020-06-03 16:21:07.634 27823-27823/io.cordova.lafcollect I/com.marianhello.bgloc.PostLocationTask: Creating PostLocationTask
2020-06-03 16:21:07.644 27823-28053/io.cordova.lafcollect I/com.marianhello.bgloc.service.LocationServiceImpl: Network condition changed has connectivity: true
2020-06-03 16:21:07.644 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [NOT STARTED] state. cmdId: [0]. startId: [1]
2020-06-03 16:21:07.651 27823-27823/io.cordova.lafcollect W/com.marianhello.bgloc.service.LocationServiceImpl: Attempt to start unconfigured service. Will use stored or default.
2020-06-03 16:21:07.664 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Will start service with: Config[distanceFilter=500 stationaryRadius=50.0 desiredAccuracy=0 interval=5000 fastestInterval=120000 activitiesInterval=10000 isDebugging=true stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true notificationsEnabled=true locationProvider=2 nTitle=LAF® Collect nText=This app is tracking location on background. nIconLarge= nIconSmall= nIconColor= url= syncUrl= syncThreshold=100 httpHeaders={} maxLocations=10000 postTemplate=null]
2020-06-03 16:21:07.672 27823-27823/io.cordova.lafcollect I/com.marianhello.bgloc.provider.RawLocationProvider: Creating RawLocationProvider
2020-06-03 16:21:07.690 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.BackgroundGeolocationFacade: Received MSG_ON_SERVICE_STARTED
2020-06-03 16:21:07.701 27823-27823/io.cordova.lafcollect D/SystemWebChromeClient: file:///android_asset/www/js/common/common.js: Line 131 : { "type": "INFO", "text" : "BackgroundGeolocation service has been started" }
2020-06-03 16:21:07.701 27823-27823/io.cordova.lafcollect I/chromium: [INFO:CONSOLE(131)] "{ "type": "INFO", "text" : "BackgroundGeolocation service has been started" }", source: file:///android_asset/www/js/common/common.js (131)
2020-06-03 16:21:07.728 27823-27966/io.cordova.lafcollect D/TEST: cdvfile://localhost/sdcard/Android/data/io.cordova.lafcollect/LAFCollect-logfile1.txt: 79
2020-06-03 16:22:03.004 27823-27823/io.cordova.lafcollect I/Surface: opservice is null false
2020-06-03 16:22:03.050 27823-27823/io.cordova.lafcollect D/CordovaActivity: Paused the activity.
2020-06-03 16:22:03.051 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be paused multitasking=true
2020-06-03 16:22:03.074 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [4]. startId: [2]
2020-06-03 16:22:03.090 27823-27823/io.cordova.lafcollect D/CordovaActivity: Stopped the activity.
2020-06-03 16:22:03.090 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is no longer visible
2020-06-03 16:22:22.162 27823-27823/io.cordova.lafcollect D/CordovaActivity: Started the activity.
2020-06-03 16:22:22.162 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is visible
2020-06-03 16:22:22.170 27823-27823/io.cordova.lafcollect D/CordovaActivity: Resumed the activity.
2020-06-03 16:22:22.171 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be resumed multitasking=true
2020-06-03 16:22:22.221 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [8]. startId: [3]
2020-06-03 16:22:22.286 27823-27846/io.cordova.lafcollect D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@ba68234[MainActivity]
2020-06-03 16:22:41.287 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.provider.RawLocationProvider: Location change: Location[gps 27.711987,85.334907 hAcc=138 et=+24m41s543ms alt=1251.425048828125 vel=0.0 vAcc=384 sAcc=7 bAcc=??? {Bundle[mParcelledData.dataSize=96]}]
2020-06-03 16:22:41.330 27823-27823/io.cordova.lafcollect I/AudioTrack: createTrack_l(107): AUDIO_OUTPUT_FLAG_FAST successful; frameCount 960 -> 960
2020-06-03 16:22:41.330 27823-27823/io.cordova.lafcollect D/AudioTrack: Uid 10416 AudioTrack::setVolume left 1.000000 right 1.000000
2020-06-03 16:22:41.331 27823-28307/io.cordova.lafcollect I/ToneGenerator: startTone:24,durationMs:1000
2020-06-03 16:22:41.331 27823-28307/io.cordova.lafcollect D/AudioTrack: ClientUid 10416 AudioTrack::start 
2020-06-03 16:22:41.335 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: New location BGLocation[gps 27.711987,85.334907 id=null acc=138 t=1591180662000 et=+24m41s543ms alt=1251.425048828125 vel=0.0 {Bundle[mParcelledData.dataSize=96]} locprov=2]
2020-06-03 16:22:41.362 27823-27823/io.cordova.lafcollect V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-06-03 16:22:41.401 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.BackgroundGeolocationFacade: Received MSG_ON_LOCATION
2020-06-03 16:22:41.426 27823-27823/io.cordova.lafcollect V/FlingOptimizerScroller: FlingOptimizerOverScroller Init
2020-06-03 16:22:41.432 27823-28306/io.cordova.lafcollect D/AudioTrack: ClientUid 10416 AudioTrack::stop 
2020-06-03 16:22:41.432 27823-28306/io.cordova.lafcollect D/AudioTrack: stop(66): called with 2112 frames delivered
2020-06-03 16:22:41.440 27823-27823/io.cordova.lafcollect V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-06-03 16:22:41.459 27823-28072/io.cordova.lafcollect D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@82a325a[MainActivity]
2020-06-03 16:22:42.335 27823-28307/io.cordova.lafcollect D/AudioTrack: ClientUid 10416 AudioTrack::stop 
2020-06-03 16:22:43.917 27823-27855/io.cordova.lafcollect D/OpenGLRenderer: endAllActiveAnimators on 0x74eb585000 (RippleDrawable) with handle 0x755532baa0
2020-06-03 16:22:43.928 27823-28072/io.cordova.lafcollect D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@ba68234[MainActivity]
2020-06-03 16:22:43.930 27823-27823/io.cordova.lafcollect D/SystemWebChromeClient: file:///android_asset/www/js/common/common.js: Line 131 : {"type":"GPS","latitude":"27.7119870","longitude":"85.3349067","accuracy":"138.28800964355469","altitude":"1251.42504882812500","speed":"0.000000000000000000","time":1591180662000,"date":"Wed Jun 03 2020 16:22:43 GMT+0545 (Nepal Time)"}
2020-06-03 16:22:43.930 27823-27823/io.cordova.lafcollect I/chromium: [INFO:CONSOLE(131)] "{"type":"GPS","latitude":"27.7119870","longitude":"85.3349067","accuracy":"138.28800964355469","altitude":"1251.42504882812500","speed":"0.000000000000000000","time":1591180662000,"date":"Wed Jun 03 2020 16:22:43 GMT+0545 (Nepal Time)"}", source: file:///android_asset/www/js/common/common.js (131)
2020-06-03 16:22:43.993 27823-28321/io.cordova.lafcollect D/TEST: cdvfile://localhost/sdcard/Android/data/io.cordova.lafcollect/LAFCollect-logfile1.txt: 238
2020-06-03 16:23:15.014 27823-27823/io.cordova.lafcollect D/CordovaActivity: Paused the activity.
2020-06-03 16:23:15.014 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be paused multitasking=true
2020-06-03 16:23:15.037 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [4]. startId: [4]
2020-06-03 16:23:15.045 27823-27823/io.cordova.lafcollect D/CordovaActivity: Stopped the activity.
2020-06-03 16:23:15.045 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is no longer visible
2020-06-03 16:23:19.069 27823-28072/io.cordova.lafcollect D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@ba68234[MainActivity]
2020-06-03 16:23:19.077 27823-27823/io.cordova.lafcollect D/CordovaActivity: Started the activity.
2020-06-03 16:23:19.078 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is visible
2020-06-03 16:23:19.102 27823-27823/io.cordova.lafcollect D/CordovaActivity: Resumed the activity.
2020-06-03 16:23:19.103 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be resumed multitasking=true
2020-06-03 16:23:19.130 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [8]. startId: [5]
2020-06-03 16:23:49.176 27823-27823/io.cordova.lafcollect D/CordovaActivity: Paused the activity.
2020-06-03 16:23:49.176 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be paused multitasking=true
2020-06-03 16:23:49.203 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [4]. startId: [6]
2020-06-03 16:23:49.219 27823-27823/io.cordova.lafcollect D/CordovaActivity: Stopped the activity.
2020-06-03 16:23:49.219 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is no longer visible
2020-06-03 16:28:29.330 27823-27823/io.cordova.lafcollect D/CordovaActivity: Started the activity.
2020-06-03 16:28:29.331 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App is visible
2020-06-03 16:28:29.343 27823-27823/io.cordova.lafcollect D/CordovaActivity: Resumed the activity.
2020-06-03 16:28:29.344 27823-27823/io.cordova.lafcollect I/com.tenforwardconsulting.bgloc.cordova.BackgroundGeolocationPlugin: App will be resumed multitasking=true
2020-06-03 16:28:29.370 27823-27823/io.cordova.lafcollect D/com.marianhello.bgloc.service.LocationServiceImpl: Service in [STARTED] state. cmdId: [8]. startId: [7]
2020-06-03 16:28:29.408 27823-28072/io.cordova.lafcollect D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@ba68234[MainActivity]

Same problem (ionic with cordova and ionic with capacitor)

I'm using this plugin and am getting location updates.
Inside the house the GPS reception is usually bad and you won't get updates as the GPS doesn't think you are moving.
I also noticed the same behavior when doing a break from a walk in nature.
I think this plugin does not update when the GPS doesn't think there's something to update.
Try going out of the house - a 50 meter walk usually is sufficient.
My code can be seen here:
https://github.com/IsraelHikingMap/Site/tree/master/IsraelHiking.Web

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale commented

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.