getTripAutoStartEnabled method

Future<bool> getTripAutoStartEnabled()

Retrieves the current automatic trip start setting.

Returns whether the SDK is currently configured to automatically detect and start recording trips based on vehicle movement patterns.

Returns:

  • bool: true if automatic trip start is enabled, false otherwise

Usage:

try {
  final autoStartEnabled = await communicator.getTripAutoStartEnabled();
  if (autoStartEnabled) {
    print('Automatic trip start is enabled');
    // Show UI indicating automatic mode
  } else {
    print('Manual trip start required');
    // Show manual start button
  }
} catch (e) {
  print('Failed to get auto start setting: $e');
}

Throws:

  • Future.error("Unable to get trip auto start pref"): When retrieval fails

Use Cases:

  • Updating UI based on current settings
  • Validating configuration state
  • Settings screen initialization
  • Debugging trip detection issues

Implementation

Future<bool> getTripAutoStartEnabled() async {
  try {
    bool tripAutoStartEnabled = await kruzr_comm.getTripAutoStartEnabled();
    return tripAutoStartEnabled;
  } on Exception catch (e, stackTrace) {
    if (kDebugMode) {
      print("Error in getTripAutoStartEnabled");
      print(stackTrace);
      print(e);
    }
    return Future.error("Unable to get trip auto start pref");
  }
}