Cordova-plugin-background-geolocation: Settings to have maximum intensity

Created on 9 Oct 2016  路  16Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Trying to figure out settings to get maximum intensity of the recorded points. The resulting path is very coarse and points frequency is way too low for the configuration parameters passed.

Your Environment

  • Plugin version: 2.2.4
  • Platform: iOS and Android
  • OS version: iOS 9.3, Android 4.2.2
  • Device manufacturer and model: iPhone 5s 64G, THL 5000
  • Cordova version (cordova -v): 6.3.1
  • Cordova platform version (cordova platform ls): android 5.2.2, ios 4.2.1
  • Plugin configuration options:
    var bgOptions = {
    stationaryRadius: 1,
    distanceFilter: 1,
    desiredAccuracy: 0,
    debug: true,
    notificationTitle: 'Background tracking',
    notificationText: 'enabled',
    notificationIconColor: '#FEDD1E',
    notificationIconLarge: 'mappointer_large',
    notificationIconSmall: 'mappointer_small',
    locationProvider: 0,// 0 or 1
    interval: 10,
    fastestInterval: 5,
    activitiesInterval: 10,
    stopOnTerminate: false,
    startOnBoot: false,
    startForeground: true,
    stopOnStillActivity: true,
    activityType: 'Fitness',
    pauseLocationUpdates: false,
    saveBatteryOnBackground: false,
    maxLocations: 100
    }
  • Link to your project: http://www.globalspeedindex.com/

Context

For Android and ANDROID_DISTANCE_FILTER_PROVIDER selected with stationary radius and distance filter set to 1, expect to get more than 400 points during 8.8 miles ride accomplished in about 1.5 hours.
route.zip

Expected Behavior

Ideally get points for each 1 meter (I understand that this is not realistic), but at least more often than 50 points per mile.

Actual Behavior

Got about 400 points per 8.8 miles.

Possible Fix

Steps to Reproduce

  1. Set parameters as above.
  2. Start tracking.
  3. Use some tool to look at the track: http://labs.easyblog.it/maps/gpx-simplify-optimizer/

Context

Very low accuracy of the measurements. The idea of the application is to have maximum information about the track to be able to analyze every detail about the ride.

Debug logs

All 16 comments

Try using ANDROID_ACTIVITY_PROVIDER it provides faster position updates.

hey @anatoly-khomenko these might help: providers and especially providers - distance filter

NOTE: distanceFilter is elastically auto-calculated by the plugin: When speed increases, distanceFilter increases; when speed decreases, so does distanceFilter.

@cordovapolymer @apptum thank you!
This helped on Android. I'm getting much more points now - about 180 per mile ( calculated for the long trip with different activities including car, walking, stationary).
Somehow I've missed the note in documentation.

Do you know by any chance how to get similar results in iOS?

Figured out for iOS as well.
The distanceFilter calculation algorithm here: is not suitable for our purpose. We had to comment out the whole calculation and return _config.distanceFilter instead. Along with using Fitness activity type and stationaryRadius=5 we got the satisfactory frequency of GPS points along the way.
Compare before:
bad-path-ios
and after:
good-path-ios

Posted pull request here. @mauron85, please, consider merging.
Thank you!

@anatoly-khomenko I agree that distance filter is not suitable for all use cases. But I'm not going to merge this. The reason is that I would like to radically improve core functionality using Finite-state machine model.

@anatoly-khomenko did you manage to keep the GPS working on android even if you close the app?

Even this fork only gives me ios position updates every 30 sec. any clue why?! Android works well

@nschurmann yes, it worked for us from the beginning. That's actually the reason we use this version of plugin, not the default Cordova implementation.
The only issue was to use ANDROID_ACTIVITY_PROVIDER to have enough points per mile.

@mamartins iOS updates position basing on the distance filter, so please, check the value for it and if you move faster than distanceFilter meters per 30 seconds, than it should give you points more often.
Android returns position once per specified time if you use ANDROID_ACTIVITY_PROVIDER which I recommend if you need high precision for the track.

@mauron85 Thank you for reviewing my pull request. I understand that the idea behind this plugin is a bit different then precision position and speed tracking. Meanwhile we'll use the fork I've created for our application and will monitor your changes. May be in future we'll switch back to your fork (which I personally would prefer).

@anatoly-khomenko yes, I have distance filter to 1 and also the debug on, on xcode I can see the positions being recorded to the DB, they're simply not pushed. Only one every 30 sec is pushed

@mamartins did you manage to solve this issue?, also sending only one position every 30 seconds instead of everything

@anatoly-khomenko how did you manage to send all the positions at once to the server?, right now with this configuration and also returning the distance filter without calculation it stores in the database the positions, but it sends every 30 seconds or so the first position and the it pops it from the array.

Notice: this issue has been closed because it has been reported for branch 2.x or later. It could be already fixed in v3 or is not relevant anymore. You may reopen this issue if it has been closed in error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sasiadstar picture sasiadstar  路  4Comments

maurojones picture maurojones  路  3Comments

anusree-mmlab picture anusree-mmlab  路  5Comments

wrunkel picture wrunkel  路  6Comments

shyamal890 picture shyamal890  路  10Comments