setTripAutoStartEnabled method
Enables or disables automatic trip start detection.
Controls whether the SDK should automatically detect and start recording trips based on vehicle movement patterns. When enabled, the SDK will automatically begin trip recording when driving behavior is detected.
Parameters:
shouldAutoStart:trueto enable automatic trip start,falseto disable
Usage:
try {
// Enable automatic trip start
await communicator.setTripAutoStartEnabled(true);
print('Automatic trip start enabled');
// Disable automatic trip start (manual start only)
await communicator.setTripAutoStartEnabled(false);
print('Automatic trip start disabled - manual start required');
} catch (e) {
print('Failed to change auto start setting: $e');
}
Throws:
Future.error("Unable to change trip auto start pref"): When setting update fails
Important Notes:
- Setting persists across app sessions
- When disabled, trips must be started manually using startTrip
- Overrides the initial configuration from Kruzr360InitConfig
- Changes take effect immediately for new trip detection
Use Cases:
- User preference settings
- Fleet management policies
- Testing and debugging scenarios
- Power management optimization
Implementation
Future<void> setTripAutoStartEnabled(bool shouldAutoStart) async {
try {
await kruzr_comm.setTripAutoStartEnabled(shouldAutoStart);
} on Exception catch (e, stackTrace) {
if (kDebugMode) {
print("Error in setTripAutoStartEnabled");
print(stackTrace);
print(e);
}
return Future.error("Unable to change trip auto start pref");
}
return;
}