autoSyncThreshold property

int? autoSyncThreshold
getter/setter pair

The minimum number of persisted records the plugin must accumulate before triggering an autoSync action.

Defaults to 0 (no threshold). If you configure a value greater-than 0, the plugin will wait until that many locations are recorded before executing HTTP requests to your server through your configured url.

Configuring an autoSyncThreshold in conjunction with batchSync:true can conserve battery by reducing the number of HTTP requests, since HTTP requests consume far more energy / second than GPS.


⚠️ Warning:

If you've configured autoSyncThreshold, it will be ignored during a BackgroundGeolocation.onMotionChange event — all queued locations will be uploaded, since:

  • If an onMotionChange event fires into the moving state, the device may have been sitting dormant for a long period of time. The plugin is eager to upload this state-change to the server as soon as possible.
  • If an onMotionChange event fires into the stationary state, the device may be about to lie dormant for a long period of time. The plugin is eager to upload all queued locations to the server before going dormant.

See also: HTTP Guide at HttpEvent.

Implementation

int? autoSyncThreshold;