diff --git a/README.md b/README.md index 971bbb2..3b1ac24 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,48 @@ -# traccar_client +# Traccar Client -A new Flutter project. +Flutter Android app for background GPS location tracking, sending data to a Traccar server. -## Getting Started +## Build -This project is a starting point for a Flutter application. +```bash +flutter build apk --debug +``` -A few resources to get you started if this is your first Flutter project: +The APK is output to `build/app/outputs/flutter-apk/app-debug.apk`. -- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter) -- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources) +## Project Structure -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +``` +lib/ + main.dart # App entry, dark theme, routing + main_screen.dart # Tracking toggle + live coordinates + permission_screen.dart # Pre-flight permission setup + settings_screen.dart # Server URL, device ID, accuracy config + status_screen.dart # Event log (LOCATION, SYNC, ERROR, etc.) + preferences.dart # SharedPreferences wrapper + bridge/ + location_bridge.dart # Dart↔Native MethodChannel (com.traccar.client/tracking) + +android/app/src/main/kotlin/com/traccar/traccar_client/ + BridgeModule.kt # Method channel handler + service/LocationTrackingService.kt + location/HeartbeatScheduler.kt # AlarmManager heartbeat + network/TraccarHttpClient.kt # POST to server + network/ConnectivityReceiver.kt +``` + +## Configuration + +On first launch, `PermissionScreen` guides through: +1. **Location** — `locationWhenInUse` then `locationAlways` (background) +2. **Notification** — required for tracking alerts +3. **Battery** — disable Doze optimization so tracking works reliably + +Then set server URL and device ID in Settings before starting tracking. + +## Server Request Format + +POST to `https://yourserver/?id=DEVICE_ID&lat=...&lon=...×tamp=...&is_moving=0` + +- `is_moving` = `speed > 1.0 m/s` (3.6 km/h threshold) +- Server URL and device ID come from `Preferences` (configured in Settings screen) \ No newline at end of file