traccar-client-android icon indicating copy to clipboard operation
traccar-client-android copied to clipboard

Add QR-based configuration and scheduled tracking start/stop, to Traccar Client Android

Open pissten opened this issue 8 months ago • 1 comments

✨ What this PR does Adds support for automatic app configuration via scanning a QR code containing a traccar://config?... URL scheme

Allows setting:

Device ID

Server URL

Tracking interval, distance, angle

Automatic service start

Start/stop time scheduling via AlarmManager

Introduces a new broadcast receiver: TrackingSchedulerReceiver

Ensures full backward compatibility for users who configure the app manually

🧩 Changes AndroidManifest.xml: Added intent-filter to capture traccar://config?... links.

MainActivity.kt: Handles deep links, updates shared preferences, schedules alarms.

TrackingSchedulerReceiver.kt: New receiver to start/stop tracking service at scheduled times.

(No breaking changes to existing preferences or flow.)

🎯 Motivation Many users configure Traccar Client manually, which can be tedious especially in large deployments (e.g., regattas, fleet tracking). This PR allows zero-touch configuration by scanning a QR code or clicking a link, improving usability for non-technical users.

📱 QR-code examples A QR code can encode a full app setup like:

bash Copy Edit traccar://config?deviceId=12345&serverUrl=https://yourserver.com/traccar&accuracy=high&interval=10&distance=5&angle=15&startTime=09:00&stopTime=17:00&service=true Or users can open the link directly from an email or webpage.

✅ Testing Manual testing on Android 12 and Android 14.

Verifying proper parsing of parameters.

Successful auto-start and auto-stop of tracking service.

Backward compatibility confirmed: app behaves exactly as before if QR or link is not used.

📚 Additional notes No changes required to preferences.xml.

No additional dependencies introduced.

The feature is optional and does not impact existing users unless they choose to use QR-based config.

pissten avatar Apr 29 '25 10:04 pissten

Is this something that would be considered merging in the near future? I have compiled my own custom apk, so I'm covered for android client side. But I would truly appreciate a iOS client version as well

pissten avatar May 28 '25 14:05 pissten