Skip to content

CurrentPositionRequest

Options for BackgroundGeolocation.getCurrentPosition.

All fields are optional. The SDK always requests location from the native API at maximum accuracy (DesiredAccuracy.High), regardless of the desiredAccuracy threshold set here.

final location = await BackgroundGeolocation.getCurrentPosition({
  timeout: 30,          // seconds before giving up
  maximumAge: 5000,     // accept a cached fix up to 5000 ms old
  desiredAccuracy: 10,  // stop sampling when accuracy ≤ 10 m
  samples: 3,           // take up to 3 samples and pick the best
  extras: {
    route_id: 123
  }
});