Add QR-based configuration and scheduled tracking start/stop, to Traccar Client Android #486
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ 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.