How to track user route between two locations?

I have two Addresses that let you say location A and location B. And I have a series of locations between these locations A and location B. I get this series of locations through the Fused location API. and saved them on the server. Following are my requirements:

What I want:               I want to calculate the distance between location A and location B. Now I use the code (post link here ), but it gives me the offset.

Problems and Confusions:

  • I know about the Google Distance API and the Google Directions api API, but I really don't want to work on this apis, as it is expensive about me. But if I use them, I really do not understand how the API will know the selected route user. I mean, perhaps the User has come a long way to his destination. And I think the Google Direction and Distance API returns the distance between location A and Loation B using the shortest route.

I really do not want to use the API, but if there are others, is it possible to do this? How could I get this? and which is better for me. Please offer me a solution.

+4
source share

Source: https://habr.com/ru/post/1687788/


All Articles