capacitor-background-geolocation icon indicating copy to clipboard operation
capacitor-background-geolocation copied to clipboard

Excessive Provider Change Events Due to Network Status Fluctuations

Open tanuj-g opened this issue 7 months ago • 3 comments

Your Environment

  • Plugin version: 5.0.0
  • Platform: Android
  • Device OS version: 11
  • Device manufacturer / model: samsung/SM-A908N
  • XCode version:
  • Capacitor info (npx cap doctor)
    Latest Dependencies:
    
    @capacitor/cli: 6.1.1
    @capacitor/core: 6.1.1
    @capacitor/android: 6.1.1
    @capacitor/ios: 6.1.1
    
    

Installed Dependencies:

@capacitor/cli: 5.0.1 @capacitor/core: 5.0.1 @capacitor/android: 5.0.1 @capacitor/ios: 5.0.1

* Plugin config provided to `#ready`:

{ /** * Application config / autoSync: true, // <-- Auto start tracking when device is powered-up. /* * Permissions Config */ backgroundPermissionRationale: { message: 'xxxxx', negativeAction: 'Cancel', positiveAction: 'Change to {backgroundPermissionOptionLabel}', title: "xxxx" }, debug: false, // <-- Enable this hear sounds for background-geolocation life-cycle. desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION, disableLocationAuthorizationAlert: true, distanceFilter: 200, elasticityMultiplier: 4, extras: {

  },
  headers: {
    ContentType: 'application/json'
  },
  isMoving: true,
  logLevel:
    config.app.STAGE == 'prod' ? BackgroundGeolocation.LOG_LEVEL_ERROR : BackgroundGeolocation.LOG_LEVEL_VERBOSE,
  reset: true,
  showsBackgroundLocationIndicator: false,
  startOnBoot: true, // <-- Auto start tracking when device is powered-up.
  stationaryRadius: 25,
  stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
  stopTimeout: 5,
  /**
   * HTTP Config
   */

  url: config.app.MOBILE_APP_LOCATIONS_URL,
  useSignificantChangesOnly: true //only uses locations determined to be "significant"
}

## Expected Behavior
Provider change events should only trigger when there is a significant and genuine change in the provider status.
Rapid and frequent toggling of the network status should be debounced or rate-limited to prevent excessive event generation.

## Actual Behavior
The network status alternates between true and false every 2 seconds.
This results in continuous provider change events, causing significant load and potential inaccuracies in our backend processing.

## Steps to Reproduce
- Don't have any idea, how one of the user is able to do this.

## Context

Impact:
The excessive events are causing performance issues in our backend.
It appears that this behaviour may be due to user spoofing, resulting in unreliable data.

Request:
Implement a debouncing mechanism to filter out rapid and insignificant changes in the provider status.
Consider adding a configurable rate limit for provider change events to ensure that only meaningful changes are processed.

tanuj-g avatar Jul 26 '24 12:07 tanuj-g