cordova-background-geolocation-lt icon indicating copy to clipboard operation
cordova-background-geolocation-lt copied to clipboard

resetOdometer returns Location containing ISO-8601 date string instead of Date instance

Open dko1905 opened this issue 2 years ago • 1 comments

Environment

  • Plugin version: cordova-background-geolocation-lt 4.4.0
  • Platform: Android
  • OS version: LineageOS 18.1 - Android 11
  • Device manufacturer / model: OnePlus 5
  • Cordova version (cordova -v): 11.0.0
  • Cordova platform version (cordova platform ls): android ^10.1.1
  • Plugin config provided to #ready:
{
	reset: true,
	url: 'http://192.168.1.44',
	autoSync: false,
	batchSync: true
}

Expected Behavior

The timestamp in the Location object returned by resetOdometer should according to the documentation contain an instance of Date and not an ISO-8601 string containing the date.

Actual Behavior

In the short code snippet below the timestamp in the Location object contains an ISO-8601 string and not a Date instance.

const geo = window.BackgroundGeolocation;
geo.resetOdometer() // <-- Bug right here
	.then(location => {
		console.log(JSON.stringify(location));
		console.log(location.timestamp); // <-- Incorrect output
		console.log(location.timestamp instanceof Date)
		console.log(new Date() instanceof Date) // Just to be sure
	})
	.catch(err => console.error(Error(err)));

This is the output of the program: image A full example project can be found here.

Android debug logs (from logcat)

Logs
0a5-16 18:41:20.272 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:20.997     0     0 W [20220516_18:41:20.996847]@1 healthd: battery l=62 v=3853 t=26.0 h=2 st=2 c=-1264000 fc=2878000 cc=2 chg=a
05-16 18:41:21.983  2249  2587 W AbstractNioWorkerPool: Failed to get all worker threads ready within 10 second(s). Make sure to specify the executor which has more threads than the requested workerCount. If unsure, use Executors.newCachedThreadPool().
05-16 18:41:22.005  2249  2587 D mobi.monaca.plugins.debugger.api.cloud.CloudSseConnection: sse.action.cloud : connected with SSE
05-16 18:41:22.277 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:26.921     0     0 W [20220516_18:41:26.920113]@0 healthd: battery l=62 v=3856 t=26.0 h=2 st=2 c=-1293000 fc=2878000 cc=2 chg=a
05-16 18:41:28.330 31658 31680 I chatty  : uid=99056(u0_i9056) ADB-JDWP Connec identical 3 lines
05-16 18:41:30.340 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:30.610  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3204 
05-16 18:41:30.611  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = false, unlocked = true
05-16 18:41:30.611  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1903 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x12000000 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=dk.sevenpeaks.danmarkleve fieldId=100 fieldName=null extras=null}, false)
05-16 18:41:30.611  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = true, unlocked = true
05-16 18:41:30.647  2249  2616 W aks.danmarklev: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (greylist, reflection, allowed)
05-16 18:41:30.672  2249  2591 W aks.danmarklev: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, reflection, allowed)
05-16 18:41:30.672  2249  2591 W aks.danmarklev: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
05-16 18:41:30.672  2249  2591 W aks.danmarklev: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, reflection, allowed)
05-16 18:41:30.689  2249  2591 D TSLocationManager: $ ready()
05-16 18:41:30.710  2249  2591 W PluginManager: THREAD WARNING: exec() call to BackgroundGeolocation.ready blocked the main thread for 21ms. Plugin should use CordovaInterface.getThreadPool().
05-16 18:41:30.717  2249  2249 I chromium: [INFO:CONSOLE(13)] "READY", source: file:///data/user/0/dk.sevenpeaks.danmarkleve/files/projects/local/6e2aaa6d18249f37e23761cdc1a6bee4c00f4cdfl/8fd15ba5e0defd9449fd7fe7b719d3b73cfeea19771e776e793230bb30644d3a/www/js/app.js (13)
05-16 18:41:31.168  2604  3544 D QCNEJ/WlanStaInfoRelay: Received action: android.net.wifi.RSSI_CHANGED
05-16 18:41:31.169  2604  3544 I QCNEJ/NativeHalConnector: -> SND notifyWlanStaStatusChanged([WlanStaInfo]: wifiSwitchState = 1 rssi = -69 ssid = AK_Home_5G bssid = b0:be:76:59:36:5d dnsInfo = 192.168.1.1;0.0.0.0;0.0.0.0;0.0.0.0; freqBand = _5GHz countryCode = dk[RatInfo]: networkType = 1 subType = 101 networkState = CONNECTED netHdl = 510211837965 ipAddrV4 = 192.168.1.147 ipAddrV6 =  ifNameV4 = wlan0 ifNameV6 =  slotIdx = 0 isAndroidValidated = true) timeStamp = 2022-05-16 18:41:31.169
05-16 18:41:31.177 10220 10881 I Discord : [NetworkMonitor] -> Network callback, onCapabilitiesChanged fired: 118
05-16 18:41:31.179 10220 10881 I Discord : [NetworkMonitor] -> Updating network state to ONLINE, API: 30
05-16 18:41:32.344 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:33.011     0     0 W [20220516_18:41:33.010364]@2 healthd: battery l=62 v=3855 t=26.0 h=2 st=2 c=-1136000 fc=2878000 cc=2 chg=a
05-16 18:41:34.203  2604  3544 D QCNEJ/WlanStaInfoRelay: Received action: android.net.wifi.RSSI_CHANGED
05-16 18:41:34.203  2604  3544 I QCNEJ/NativeHalConnector: -> SND notifyWlanStaStatusChanged([WlanStaInfo]: wifiSwitchState = 1 rssi = -61 ssid = AK_Home_5G bssid = b0:be:76:59:36:5d dnsInfo = 192.168.1.1;0.0.0.0;0.0.0.0;0.0.0.0; freqBand = _5GHz countryCode = dk[RatInfo]: networkType = 1 subType = 101 networkState = CONNECTED netHdl = 510211837965 ipAddrV4 = 192.168.1.147 ipAddrV6 =  ifNameV4 = wlan0 ifNameV6 =  slotIdx = 0 isAndroidValidated = true) timeStamp = 2022-05-16 18:41:34.203
05-16 18:41:34.215 10220 10881 I Discord : [NetworkMonitor] -> Network callback, onCapabilitiesChanged fired: 118
05-16 18:41:34.216 10220 10881 I Discord : [NetworkMonitor] -> Updating network state to ONLINE, API: 30
05-16 18:41:34.351 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:35.951     0     0 E [20220516_18:41:35.950012]@0 synaptics,s3320: all finger up
05-16 18:41:36.393  1475  5773 I ActivityTaskManager: START u0 {cmp=dk.sevenpeaks.danmarkleve/mobi.monaca.plugins.debugger.activity.menu.AppLogActivity (has extras)} from uid 10193
05-16 18:41:36.358 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:36.404  2249  2249 D CordovaActivity: Paused the activity.
05-16 18:41:36.406  2249  2249 D search  : sleep
05-16 18:41:36.410  1475  5773 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (102833892)
05-16 18:41:36.464  1475  6079 I WifiService: acquireMulticastLock uid=10193
05-16 18:41:36.500  2249  2249 D app     : NetworkUtil WIFI connected
05-16 18:41:36.505  1475  1614 I ActivityTaskManager: Displayed dk.sevenpeaks.danmarkleve/mobi.monaca.plugins.debugger.activity.menu.AppLogActivity: +112ms
05-16 18:41:36.516  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3204 
05-16 18:41:36.517  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = false, unlocked = true
05-16 18:41:36.517  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1903 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=dk.sevenpeaks.danmarkleve fieldId=-1 fieldName=null extras=null}, false)
05-16 18:41:36.517  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = true, unlocked = true
05-16 18:41:36.731  2249  2249 D CordovaActivity: Stopped the activity.
05-16 18:41:37.087   844   844 D vendor.qti.vibrator: QTI Vibrator reporting capabilities: 3
05-16 18:41:37.209  1475  1591 D AutofillManagerService: onBackKeyPressed()
05-16 18:41:37.237  2249  2249 D search  : sleep
05-16 18:41:37.247  2249  2249 D CordovaActivity: Incoming Result. Request code = 1
05-16 18:41:37.247  2249  2249 W CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it.
05-16 18:41:37.250  2249  2249 D CordovaActivity: Started the activity.
05-16 18:41:37.252  2249  2249 D CordovaActivity: Resumed the activity.
05-16 18:41:37.258  1475  6079 I WifiService: acquireMulticastLock uid=10193
05-16 18:41:37.277  2249  2249 D app     : NetworkUtil WIFI connected
05-16 18:41:37.306  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3204 
05-16 18:41:37.307  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = false, unlocked = true
05-16 18:41:37.307  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1903 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x12000000 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=dk.sevenpeaks.danmarkleve fieldId=100 fieldName=null extras=null}, false)
05-16 18:41:37.307  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = true, unlocked = true
05-16 18:41:37.331  2402  2428 W System  : A resource failed to call release. 
05-16 18:41:38.033  2249  2591 D TSLocationManager: $ setOdometer()
05-16 18:41:38.068   804   804 E LocSvc_APIClientBase: locAPIUpdateTrackingOptions:386] invalid or stopped session: 262.
05-16 18:41:38.075  1475  6079 D SensorService: 	>> activate, handle=1, enabled=1
05-16 18:41:38.078  1475  1590 I GnssLocationProvider: GNSS HAL Requesting location updates from network provider for 10000 millis.
05-16 18:41:38.079 23066 23184 W Looper  : Looper already prepared for this thread with a different value for the LOOPER_PREPARE_ALLOW_NON_CALLBACKS option.
05-16 18:41:38.080  1475  1524 D SensorService: 	>> activate, handle=1, enabled=1
05-16 18:41:38.082  1475  1524 D SensorService: 	>> activate, handle=4, enabled=1
05-16 18:41:38.082   865   887 E Sensors : sns_reg_la.c(187):reg read: offset 2304, num bytes: 1
05-16 18:41:38.093  1475  1524 D SensorService: 	>> activate, handle=6, enabled=1
05-16 18:41:38.094   865   887 E Sensors : sns_reg_la.c(187):reg read: offset 2304, num bytes: 1
05-16 18:41:38.100  1475  1524 D SensorService: 	>> activate, handle=3, enabled=1
05-16 18:41:38.101   865   887 E Sensors : sns_reg_la.c(187):reg read: offset 2304, num bytes: 1
05-16 18:41:38.133 23066 23184 W inertial-anchor: Significant calibration change for SENSOR_TYPE_MAGNETOMETER_UT from CAL_SOURCE_UNCAL_SENSOR, delta=286.157, threshold=5, at time: 155009380245009
05-16 18:41:38.133 23066 23184 W inertial-anchor: Reinitializing due to significant calibration change
05-16 18:41:38.363 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:38.403 23066 23184 W inertial-anchor: Max norm deviation percent value of 0 is non-positive. Aborting anomalous mag measurement detection.
05-16 18:41:38.630  2249  2663 W mobi.monaca.plugins.debugger.api.cloud.CloudSseConnection: Cloud SSE Error : count = 0, status = Not event stream: https://ws.monaca.mobi/events?api_token=8a6db6501bcd98ec82ba5fb42b4ef06a87f86618 (expected Content-Type: text/event-stream, cause = null
05-16 18:41:38.911  1475  1475 W NotificationHistory: Attempted to add notif for locked/gone/disabled user 0
05-16 18:41:38.970  1475  1524 D WifiNl80211Manager: Scan result ready event
05-16 18:41:38.970  1475  1524 D WifiNative: Scan result ready event
05-16 18:41:38.970  1081  6303 I LOWI-8.6.0.72: [LOWI-Scan] lowi_close_record:Scan done in 154984769ms, 3 APs in scan results
05-16 18:41:39.007     0     0 W [20220516_18:41:39.007099]@2 healthd: battery l=62 v=3846 t=26.0 h=2 st=2 c=-1143000 fc=2878000 cc=2 chg=a
05-16 18:41:39.023  1475  2395 D SensorService: 	>> activate, handle=1, enabled=0
05-16 18:41:39.028  1475  1524 D SensorService: 	>> activate, handle=1, enabled=0
05-16 18:41:39.029  1475  1524 D SensorService: 	>> activate, handle=4, enabled=0
05-16 18:41:39.033  1475  1524 D SensorService: 	>> activate, handle=6, enabled=0
05-16 18:41:39.036  1475  1524 D SensorService: 	>> activate, handle=3, enabled=0
05-16 18:41:39.041   865   887 E Sensors : sns_reg_la.c(295):reg write: offset 1792, num bytes: 24
05-16 18:41:39.058  2249  2249 I chromium: [INFO:CONSOLE(20)] "{"is_moving":false,"uuid":"993876fa-a498-47de-afe6-fad1aa74c9f5","timestamp":"2022-05-16T16:41:38.453Z","odometer":0,"coords":{"latitude":55.4963024,"longitude":12.1909598,"accuracy":20,"speed":-1,"speed_accuracy":-1,"heading":-1,"heading_accuracy":-1,"altitude":40.5,"altitude_accuracy":2.6},"activity":{"type":"still","confidence":100},"battery":{"is_charging":true,"level":0.62},"extras":{}}", source: file:///data/user/0/dk.sevenpeaks.danmarkleve/files/projects/local/6e2aaa6d18249f37e23761cdc1a6bee4c00f4cdfl/8fd15ba5e0defd9449fd7fe7b719d3b73cfeea19771e776e793230bb30644d3a/www/js/app.js (20)
05-16 18:41:39.059  2249  2249 I chromium: [INFO:CONSOLE(21)] "2022-05-16T16:41:38.453Z", source: file:///data/user/0/dk.sevenpeaks.danmarkleve/files/projects/local/6e2aaa6d18249f37e23761cdc1a6bee4c00f4cdfl/8fd15ba5e0defd9449fd7fe7b719d3b73cfeea19771e776e793230bb30644d3a/www/js/app.js (21)
05-16 18:41:39.059  2249  2249 I chromium: [INFO:CONSOLE(22)] "false", source: file:///data/user/0/dk.sevenpeaks.danmarkleve/files/projects/local/6e2aaa6d18249f37e23761cdc1a6bee4c00f4cdfl/8fd15ba5e0defd9449fd7fe7b719d3b73cfeea19771e776e793230bb30644d3a/www/js/app.js (22)
05-16 18:41:39.059  2249  2249 I chromium: [INFO:CONSOLE(23)] "true", source: file:///data/user/0/dk.sevenpeaks.danmarkleve/files/projects/local/6e2aaa6d18249f37e23761cdc1a6bee4c00f4cdfl/8fd15ba5e0defd9449fd7fe7b719d3b73cfeea19771e776e793230bb30644d3a/www/js/app.js (23)
05-16 18:41:39.061  1475  5773 W AppOps  : Noting op not finished: uid 10134 pkg com.google.android.gms code 79 startTime of in progress event=1652717507650
05-16 18:41:39.064  1475  5773 W AppOps  : Noting op not finished: uid 10134 pkg com.google.android.gms code 79 startTime of in progress event=1652717507650
05-16 18:41:39.212  1475  1475 W NotificationHistory: Attempted to add notif for locked/gone/disabled user 0
05-16 18:41:39.986  1475  4249 I ActivityTaskManager: START u0 {cmp=dk.sevenpeaks.danmarkleve/mobi.monaca.plugins.debugger.activity.menu.AppLogActivity (has extras)} from uid 10193
05-16 18:41:39.996  2249  2249 D CordovaActivity: Paused the activity.
05-16 18:41:39.998  2249  2249 D search  : sleep
05-16 18:41:40.002  1475  4249 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (102858572)
05-16 18:41:40.042  1475  4249 I WifiService: acquireMulticastLock uid=10193
05-16 18:41:40.095  2249  2249 D app     : NetworkUtil WIFI connected
05-16 18:41:40.099  1475  1614 I ActivityTaskManager: Displayed dk.sevenpeaks.danmarkleve/mobi.monaca.plugins.debugger.activity.menu.AppLogActivity: +112ms
05-16 18:41:40.110  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3204 
05-16 18:41:40.110  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = false, unlocked = true
05-16 18:41:40.111  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1903 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=dk.sevenpeaks.danmarkleve fieldId=-1 fieldName=null extras=null}, false)
05-16 18:41:40.111  3394  3394 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2100 checkRepeatedly = true, unlocked = true
05-16 18:41:40.324  2249  2249 D CordovaActivity: Stopped the activity.
05-16 18:41:40.364 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:40.761     0     0 E [20220516_18:41:40.761605]@0 synaptics,s3320: all finger up
05-16 18:41:42.381 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:43.992  1475  6079 D WifiNl80211Manager: Scan result ready event
05-16 18:41:43.992  1475  6079 D WifiNative: Scan result ready event
05-16 18:41:43.992  1081  6303 I LOWI-8.6.0.72: [LOWI-Scan] lowi_close_record:Scan done in 154989791ms, 3 APs in scan results
05-16 18:41:44.001  1475  2342 D WificondScannerImpl: Filtering out 1 scan results.
05-16 18:41:44.420 31658 31680 E ocessService0:: failed to create Unix domain socket: Operation not permitted
05-16 18:41:44.563     0     0 E [20220516_18:41:44.562750]@0 BQ: bq27541_battery_soc: bq27541_battery_soc = 63
05-16 18:41:44.573     0     0 I [20220516_18:41:44.572232]@0 BQ: fg_soc_calibrate: soc:63, soc_calib:63, VOLT:3849, current:-1246

dko1905 avatar May 16 '22 16:05 dko1905

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. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] avatar Sep 21 '22 03:09 stale[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 18 '24 01:04 github-actions[bot]