changePace static method

Future<bool> changePace(
  1. bool isMoving
)

Manually toggles the plugin's motion state between stationary and moving.

When provided a value of true, the plugin will engage location-services and begin aggressively tracking the device's location immediately, bypassing stationary monitoring.

If you were making a "Jogging" application, this would be your [Start Workout] button to immediately begin location-tracking. Send false to turn off location-services and return the plugin to the stationary state.

Example

BackgroundGeolocation.changePace(true);  // <-- Location-services ON ("moving" state)
BackgroundGeolocation.changePace(false); // <-- Location-services OFF ("stationary" state)

Implementation

static Future<bool> changePace(bool isMoving) async {
  try {
    return (await _methodChannel.invokeMethod<bool>('changePace', isMoving))
        as FutureOr<bool>;
  } on PlatformException catch (e) {
    throw Error(e);
  }
}