traccar_client_sdk 0.0.14
traccar_client_sdk: ^0.0.14 copied to clipboard
Flutter plugin for background location tracking. Wraps the Traccar Client SDK for Android and iOS.
traccar_client_sdk #
Flutter plugin for background location tracking. Sends position updates over a simple HTTP GET protocol - works with Traccar and any compatible server. Wraps the Traccar Client SDK for Android and iOS - see the main repository for architecture, reliability, and configuration details.
Requires Android API 24+ and iOS 15+.
Usage #
import 'package:traccar_client_sdk/traccar_client_sdk.dart';
final tracker = TraccarClientSdk();
await tracker.start(Config(
serverUrl: 'https://demo.traccar.org',
deviceId: '123456',
));
await tracker.stop();
API #
start(Config)- begin tracking. Returnsfalseif required Android permissions were denied.stop()- stop tracking and clear saved config.requestPosition(Config)- one-off fix and upload, independent ofstart/stop.isTracking()- query current state.getLogs()- recent diagnostic entries (timems,message).clearLogs()- clear the diagnostic store.
Configuration #
Config accepts a LocationConfig (accuracy, distanceMeters, intervalSeconds, angleDegrees, stopDetection, stopTimeoutSeconds, stationaryRadiusMeters), a Boolean buffer (real-time-only when false), Android-only wakeLock, and a NotificationConfig for the Android foreground-service text. See the main repo for details and defaults.
Permissions #
The plugin requests location, notification (Android 13+), and activity recognition (Android 10+) permissions at runtime via a transparent activity. On first start it also opens the Ignore Battery Optimization settings screen once.
On iOS, add these keys to your app's Info.plist:
NSLocationAlwaysAndWhenInUseUsageDescriptionNSLocationWhenInUseUsageDescriptionNSMotionUsageDescription
and enable the Location updates background mode in your target capabilities.
License #
Apache License 2.0 - see LICENSE.