docs: rewrite README.md with project overview and structure

This commit is contained in:
fiatcode 2026-04-30 16:48:43 +07:00
parent a291a972aa
commit 33935de4f2
No known key found for this signature in database

View file

@ -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) ## Project Structure
- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
For help getting started with Flutter development, view the ```
[online documentation](https://docs.flutter.dev/), which offers tutorials, lib/
samples, guidance on mobile development, and a full API reference. 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=...&timestamp=...&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)