transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
659 stars 276 forks source link

Consistency/accuracy of gps locations #607

Closed LarsBocons closed 6 years ago

LarsBocons commented 6 years ago

I've been holding this back for a while, since I have not yet come up with something precise to pinpoint, but we seem to have problems consistantly receiving positions. It's all a bit fuzzy and inconsistant, so all we can do is to try and reach out blindfolded:

Your Environment

Expected Behavior

Excpect to receive at least one location per second (at least when moving)

Actual Behavior

What we have experienced in out test, is that the positions seems to take a long time to reach our required accuracy (30 meters). Also there have been gaps of 1-10 minutes between positions (debug sound verifies this) while moving. Our app is running in front and use power management to prevent the screen from turning off.

We have also experienced what seems to be a 10 minute suspend (even though it looked like the app was running), a javacript timer increments a counter every 30 seconds, but took 10 minutes to increment. Is there any way the component could affect the javascript in this way?

Problem seems to be mostly affecting iOS, but even with Android it seems like it's harder to get a position with acceptable accuracy. Could there be something in the component that turns down the throttle? We just want to turn it up to full, with no regard to battery consumption.

We have so far solved the slow-accuracy problem by supplementing with HTM5 navigator reception, but we would rather just use one source of gps location. Do you se any problem with this approach by the way?

christocracy commented 6 years ago

Is there any way the component could affect the javascript in this way?

No.

Could there be something in the component that turns down the throttle?

No. Only the OS.

If the device is moving, the plugin has requested locations from the device according to your configuration.

This is 7 days of uninterrupted tracking in my home town during xmas: Google Pixel @ 8.1.0 . This app was not touched during this time. It never failed to miss a beat. If you're experiencing issues, it's either the OS or the network environment.

iPhone X

ℹ️ I did not always have the Pixel on me. I always had the iPhone X on me.

LarsBocons commented 6 years ago

Ok, as I said it's all a bit random, so hard to pinpoint anything.

We have also experienced a few "MainThread" & "WebThread" app crashes after updating to iOS 11, which seem unrelated to your component.

In theory a hybrid app should never crash, right? I mean, no matter how much you mess up the javascript, it should just do nothing, or display an error ( if you told it too) ?

christocracy commented 6 years ago

In theory a hybrid app should never crash, right?

Could not be more false. It’s only hybrid in the sense you get the define a common view using html/css and a layer of JavaScript business logic. Under the hood, it’s a pure native app.

This background geolocation plugin is a pure native library with a thin Cordova facade in front of it. The library works just as well in pure native apps.

We have also experienced a few "MainThread" & "WebThread"

You’re probably using some plugins interacting with UIApplication in background thread. For example

LarsBocons commented 6 years ago

With "in theory" I mean assuming that no plugins are used, no pure javascript should be able to crash an app.

During gps reception there's no interaction with other plugins. localStorage is used to temporary hold on to locations, but that is pure javascript as far as I know. The error we got a few times now, is exactly the same as this one: App crash on low memory notification with custom fonts (iOS only) ...except it is caused by the WebView thread.

christocracy commented 6 years ago

I don't know what to tell you. It's not related to this plugin if you don't have a stacktrace referencing the plugin.

LarsBocons commented 6 years ago

Sorry, you must have missed the "which seem unrelated to your component" comment above. I'm not blaming your plugin for the crashes, just posting info in hope that maybe someone will put 2 & 2 together.

The code has worked for years without ever crashing, but we had to do something about the new iOS 11 security additions. So the main suspect is iOS 11.

I have now updated to latest vesions of all included cordova plugins, and will see if that changes anything.