Android Question Draw a route on the map

DavideTr94

Member
Hello everyone, I state that I am new in the Forum so sorry if I make mistakes.
I have been using B4a for several years and now I am working on an application for a Hoverboard model which among the various functions calculates the distance the user has traveled.

When the user charges the Hoerboard battery, the application saves a "Record" which contains various information and displays it in a list.

I would like to implement a function that while the user is running, the app traces the path the user makes on a map, but not with a straight line between a point A and a point B, I would like the course to be traced corrected on the map.

Since I never needed to work with maps, I am not informed about it. If someone can help me with an example, I could adapt it for my needs, that is that when the user slows down and stops completely for 30 seconds, a marker is added on the map, when the user restarts, the application will continue to trace the path.

Finally, when the user charges the battery of the Hverboard, the application saves this "Record" as always and the user can view his route on the map by clicking on the item in the list.

In summary the questions are:
1). How to write a course with a colored line on the map (which respects the correct roads)?
2). How can I add one or more Markers above this route marked on the map?

Thanks for your help.
 

DavideTr94

Member
Store the coordinates in a list. You can use a timer and check MyLocation every X seconds.
Add a polyline with Map.AddPolyline. Set the points with Polyline.Points = YourList

Thanks, I try this afternoon, it won't be difficult ;)

Yesterday I saw this example ( https://www.b4x.com/android/forum/threads/draw-a-line-between-two-waypoints-in-map-streets.18185/ ) but for me it is not good, this trace of straight lines from point A to point B :confused:

EDIT: I tried but I have some doubts, can someone give me a small example of a script? Thanks
 
Last edited:
Upvote 0
Top