Track My Vehicle

TMV is an end to end system that uses commodity Android hardware, a custom APK, along with a NodeJS RESTful API to track vehicles and intiate a call to an emergency contact should the vehcile be interfered with when armed (detected using the inbuilt accelerometers).

This is partially a follow on from my earlier FollowMe work - that wasn't intended for permanent use and would require more data than necessary.

What makes this work?

Android APK

The Android/JAVA APK provides a bare-bones UI and starts a Location Service that runs indefinitely.  It uses the aggregate of X, Y & Z accelerometer readings - checked once every second - to decide if the vehicle the hardware is fixed to is being driven or bumped.  In the event there is no movement network updates are delayed incrementally for up to 1 hr.  When the vehicle is moving updates are POSTed every 20s.

SIM

In a randomly chosen week (7 days) the app consumed 14MB, this ranged from 240kB (on a day where the vehicle did not move) to 4MB when it was on a 3hr cross-country drive.

A SIM from a budget provider like 1pMobile or GiffGaff would require an annual spend between £48 and £72 (as at March 2025 prices).

Hardware

Phone mounted in FrunkOld flagship devices like the Samsung Galaxy S5 come with many sensors and replaceable batteries.  These can now be got for as little as £30 and are easy to update with LineageOS.  Testing was done with a "degoogled"
Android 9 (API 28) device. 

Power

Power from 12v batter with inline 1A fuseWhilst the system doesn't NEED permanent power it's rather pointless without it. 

I have powered the device permanently with a 12v-5v DC DC Buck Converter wired to the 12v battery (of an EV) though a 1A inline fuse.  

Indicative power consumptionThis creates a parasitic battery draw of 67mA @ 5v (or 0.4w) - a useless google shows 0.6w is a "normal" parasitic draw.

I have had this set up for over a year without power issue.

UI / Mapping

I've switched from Google Maps to Bing Maps, but finally settled on using OpenStreetMaps with OpenLayers2 if you set up your own backend (or even if you use mine) you can map with whatever you like.

RESTful API

When the APK is installed no backend URL is defined, one has to be entered via the local UI, this is stored using SharedPreferences. Nothing will work as intended until this is done.

The (random) GUID generated and saved into SharedPreferences should be considered sensitve since it will allow the device to be tracked 24x7.  

If the GUID is lost / handed out, the SharedPreferences need to be wiped by clearing the app's local storage to generate a new one.

API endpoints with examples and explanation 

 

Live vehicle tracking and alerting using old Android hardware (updated with LineageOS) a custom Android/JAVA APK reporting to a NodeJS server peristing data in a MariaDB database.

What makes this work

APK | SIM | Hardware | UI / Mapping | RESTful API

UI View