changePace static method

Future<State> 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)

(WO-033) Resolves the State, as the API's other state-changing methods do and as the documented contract has always said. Until now this returned Future<bool>, echoing the argument the caller had just passed — a BREAKING change for Dart callers, who read state.isMoving instead of the bare bool.

Implementation

static Future<State> changePace(bool isMoving) async {
  Map state = (await _methodChannel.invokeMapMethod('changePace', isMoving))!;
  return State(state);
}