Configuration Profiles
Tracelet comes with several pre-defined configuration profiles to help you quickly set up background geolocation for different use cases. These profiles optimize the trade-off between battery drain and location accuracy.
Available Profiles
1. Balanced (Config.balanced())
This is the recommended default for most applications. It provides a highly optimized balance between capturing detailed routes and preserving battery life.
- Target Use Case: Delivery apps, fleet tracking, mileage logging.
- Accuracy: Medium to High (Hardware dependent)
- Distance Filter: ~20-50 meters
- Battery Drain: Low (~1-3% per hour)
- Adaptive Sampling: Enabled
final config = Config.balanced(
stopOnTerminate: false,
startOnBoot: true,
);
await Tracelet.ready(config);2. High Accuracy (Config.highAccuracy())
This profile forces the GPS hardware to stay active and requests the highest possible precision. It disables most battery-saving heuristics.
- Target Use Case: Turn-by-turn navigation, sports tracking (running, cycling), exact geofence triggers.
- Accuracy: Maximum (1-5 meters)
- Distance Filter: 0-10 meters
- Battery Drain: High (~5-10% per hour)
- Adaptive Sampling: Disabled
final config = Config.highAccuracy(
stopOnTerminate: false,
startOnBoot: true,
);
await Tracelet.ready(config);3. Low Power (Config.lowPower())
This profile minimizes battery impact by relying primarily on cell tower triangulation and Wi-Fi networks instead of the power-hungry GPS chip. Updates are less frequent and less precise.
- Target Use Case: Social apps, weather updates, generalized area tracking.
- Accuracy: City/Neighborhood level (100-3000 meters)
- Distance Filter: ~500+ meters
- Battery Drain: Negligible (less than 1% per hour)
- Adaptive Sampling: Enabled
final config = Config.lowPower(
stopOnTerminate: false,
startOnBoot: true,
);
await Tracelet.ready(config);4. Passive (Config.passive())
This profile represents the extreme end of battery optimization. On Android, it will not actively turn on the GPS or Wi-Fi scanners; instead, it passively “piggybacks” on location requests made by other apps (e.g., Google Maps, Weather apps) or the OS. On iOS, which lacks a true passive API, this falls back to the lowest possible accuracy (kCLLocationAccuracyThreeKilometers), functioning similarly to the Low Power profile.
- Target Use Case: Extreme battery saving, background data collection without user impact.
- Accuracy: Variable (depends on what other apps request on Android; 3km on iOS)
- Battery Drain: Zero to negligible
- Adaptive Sampling: Disabled
final config = Config.passive(
stopOnTerminate: false,
startOnBoot: true,
);
await Tracelet.ready(config);Customizing Profiles
Profiles are just pre-configured Config instances. You can start with a profile and override specific fields using .copyWith():
final config = Config.balanced().copyWith(
geo: GeoConfig(
distanceFilter: 10, // Override just the distance filter
),
sync: SyncConfig(
url: 'https://my-api.com/locations',
),
);