Traccar Server (Lite) without Java

AntonK6 years ago

I was thinking about running Traccar Server at the host where Java isn't available, but apparently it won't work out of the box :)
One of the approaches is to partially re-implement the functionality using the language which is usually available at free hostings (PHP is the good candidate for this). Such task may be simplified in my case, since I use only Android Traccar Client which reports via OsmAnd protocol. All data may be accumulated in a MySQL database, which is supported by the framework, and I guess even remote connection may work (cool!), though this is rarely available for free.
I believe, the Traccar Web Interface may also work with a PHP-coded back-end.
The task seems to be feasible, unless I overlook something crucial.
I hope I won't violate the license if I undertake for development of an alternative lite server.
Can you please comment on this?

The first subtask is to create tables in the DB. Traccar Server may create the tables on its own (I guess, during first run). Are there any other ways to prepare the DB for use except for installing the server and MySQL locally? Remote MySQL connection isn't available at the hosting I use.

Anton Tananaev6 years ago

It is feasible, but you would have to implement quite a few API calls, so it will be a lot of work. It doesn't violate any license. It would be awesome if you can make it open source as well.

As for database, the easiest option is probably to let Liquibase generate all the queries and then apply those queries on your database.

AntonK6 years ago

Thanks for the reply.
I've created the repository for the project.
I wasn't familiar with Liquibase (nice tool - will try it somehow), so I went the longer road: installed MySQL and Traccar Server locally, and then exported the new DB as SQL scripts.
In the minimal configuration (to collect positions) only 3 tables seem to be enough: groups, devices and positions.
With a test PHP script I was able to get positions from my device (the Android app hasn't noticed the switch to a non-native back-end) and dumped them to a log file for investigations...
While most Web-request values are easy to put into tables, few of them are not so straighforward in "decoding":

  1. timestamp (Unix timestamp) goes into positions.devicetime (after conversion), right?
  2. What is bearing? Is it stored into positions.course?
  3. Where should batt (battery charge) stored?
  4. How positions.fixtime is initialized? Which time is stored there?
  5. What to store into positions.protocol for positions coming from Android Client?
  6. What is positions.valid for? Which validity is meant? May I just store 1 there for each reported position or the client somehow reports when position is invalid?
  7. Which time is used to update devices.lastupdate? Is it server time there?

I believe, I could find the answers in the code, and it seems to be a quite long way to go, so I'd appreciate if you could quickly give me some hints where to dig the information or provide brief answers (the latter would be just great!).
Thanks in advance for your help!

Anton Tananaev6 years ago

You can check OsmAndProtocolDecoder and other relevant classes to see what goes where.