locationTimeout property

int? locationTimeout
getter/setter pair

The default timeout in seconds when requesting a location before the SDK gives up and fires a LocationError.

Defaults to 60 seconds.

Example

// With onLocation event
BackgroundGeolocation.onLocation((Location location) {
 print("[onLocation] success $location");
}, ((LocationError error) {
  if (error.code == 408) {
    print("[onLocation] error: LOCATION TIMEOUT $error");
  }
});

// With getCurrentPosition:
try {
  Location location = await BackgroundGeolocation.getCurrentPosition(samples: 3);
} catch((dynamic error) {
  if (error.code == 408) {
    print("[getCurrentPosition] error: LOCATION TIMEOUT $error");
  }
});

See Also:

Implementation

int? locationTimeout;