Skip to content

LocationFilterEvent

export interface LocationFilterEvent {

Delivered to BackgroundGeolocation.onLocationFilter when the SDK's tracking location-filter rejects a raw location sample.

Rejected locations are not delivered to BackgroundGeolocation.onLocation, so this event is the only way to observe and adapt to them (eg: accuracy degrading while stationary).

BackgroundGeolocation.onLocationFilter((event) => {
  console.log("[onLocationFilter] rejected:", event.reason, event.accuracy);
  if (event.accuracy > event.trackingAccuracyThreshold * 5) {
    // GPS has degraded badly — adapt (eg: surface a "poor signal" hint).
  }
});

Members

accuracy

accuracy: number;

Horizontal accuracy (meters) of the rejected sample. Convenience copy of Location.coords.accuracy for quick threshold comparison.

location

location:Location;

The rejected location (the raw sample that failed the filter).

The coordinates, accuracy, and timestamp describe the rejected sample itself. Derived fields such as Location.odometer reflect the last accepted fix — a rejected sample does not advance the odometer.

reason

reason:LocationFilterReason;

Normalized reason the location was rejected.

trackingAccuracyThreshold

trackingAccuracyThreshold: number;

The LocationFilter.trackingAccuracyThreshold (meters) in effect when the sample was rejected. Lets you detect "accuracy degraded past my threshold" without separately reading the config.