Whenever you get a location from a mobile device it will show you a blue dot and a circle around it, and send a random location within that circle. Sometimes this would lead to the user being on one side of the road and the location showing him on the other side of the road.
To control this we implemented a location accuracy check where each time we got the user’s location, we also checked the location’s accuracy and if the accuracy was higher than a certain limit we discarded that location and got a new location.
One of the requirements we received from the client was to draw the path a user took for a trip. When we drew all the saved locations, for a trip on the map, it was rarely a straight line, even on straight roads.
To resolve this issue we used an API provided by Google called "Roads API”. We passed saved paths to the roads API and it would return a list of points exactly on the road.
Another requirement from the client was to get a list of all the active users and filter them based on the status of the location. One of these filters was whether the users would complete their trip on time or not. We implemented this logic on the backend using Google API and every time the admin visited that page the list would get refreshed, we were billed 1500 USD within 2 days.
We decided to move this logic to the mobile side and saved the data in the database. And each time the admin visited the filters page he would see the saved data. Doing this not only helped with the cost it also helped us increase the page speed dramatically.
Java & Swift