Menu

Home

Ebo Eppenga

Simple OpenGTS Tracker

Very simple and easy to implement GPS / Cell tracker. It uses an app on your phone to relay data to this script. The script then displays an OpenStreetMap via the browser. Consists of just one simple PHP file, no MySQL required.

Installation

  1. Copy the file tracker.php to your PHP enabled webserver
  2. Download Traccar or any OpenGTS client to your phone, setup and run
  3. Surf to where you stored the tracker.php file, ie. http://www.foo.com/path/tracker.php

Tracking App

The PHP script relies on a tracking app stored on your phone or any other device. Any suitable OpenGTS type client should work as long as the query string provided looks something like below. The query string might contain more variables like id, speed, altitude, etc... but those are not required.
http://foo.com/path/tracker.php?lat=51.9233494&lon=4.2611437

Traccar

Personally I use Traccar as the tracking app as it works will and is energy effiicent.
Android: https://play.google.com/store/apps/details?id=org.traccar.client
iPhone: https://apps.apple.com/nl/app/traccar-client/id843156974

Please change "Server URL" the app to where you stored the tracker.php file:
"Server URL": http://www.foo.com/path/tracker.php

Please note this is the same URL as used to display your location in the browser. The PHP script automatically recognizes if the app is uploading data or if you would like to see your phone's location in the browser. Easy! :)

Energy and Autostart issues on your phone with Traccar

Although Traccar should run fine out of the box and autostart when you switch on your phone, it might be that some phones kill this app because of strict non standard energy settings. If this happens a solution could be to use the "Tasker" app for Android, I am not aware of an iPhone alternative.

What I do is set up a new profile called "Launch" in "Tasker". The profile triggers on the event "Monitor Start", which means it does something as soon as the phone is switched on. A task called "Traccar" is added to that profile which launches the Traccar client, then waits for half a second and lastly presses the back button automatically so focus is restored to the phone's display.

Steps of the task in "Tasker"
1. Launches (Launch App) Traccar client
2. Wait 500 miliseconds
3. Back button

Setting up "Tasker" in a power efficient way is well documented here:
https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00