I am working on gps tracking in android to track the user location and provide the feature to record the track.I am able to draw path now i want to calculate the track distance and time with that like suppose user start tracking record and move to another location now i want to calculate total distance and time travel for from start to end position (with user location update) in google map. I have function which calculate the distance for 2 position but that not fit for my route, because route are in polyline and it’s flexible lat/lng position. is their any api or any function or services provide by google for that. any help or suggestion are appreciate.
Share
I would create a class called waypoint
Then create a list of these classes which allows inserting of elements at any position which is helpful if your route changes:
Then convert to array and calculate the totals: