Hi i am developing a application where i tracks users current location periodically and update the path in Google map by drawing polylines . I am Not sure how to do that. Please Help me Out in this issue.
Asked
Active
Viewed 1,445 times
-1
-
have you tried to search before asking? all you need to do is just to define PolylineOptions https://developer.android.com/reference/com/google/android/gms/maps/model/PolylineOptions.html and then just draw it – nikis Apr 21 '15 at 14:10
-
how to get the location periodically .Even when the device is locked and update polyline? – Rathiesh Rajasekar Apr 22 '15 at 07:01
1 Answers
2
After drawing the Polyline for the first time, you can "update" that polyline by retrieving the actual points (getPoints()) and then adding the new location to that list, then updating PolylinePoints (setPoints()) https://developer.android.com/reference/com/google/android/gms/maps/model/Polyline.html#getPoints()
Keep in mind that getPoints gives you a COPY of the points, not the reference to the list.

N Dorigatti
- 3,482
- 2
- 22
- 33
-
hi, i am trying to add new location on every 2 seconds of interval. it works good till 4000 or nearby points but after that my application is hanging. Do you have any possible solutions on same? – Arti Patel Sep 18 '17 at 10:18
-
well... 4000 markers on gmaps is quite a "big" number... Gmaps is not a GIS library, it's light mapping... you should consider simplifying the markers (a sort of clustering data, depending on the zoom level), or remove the older markers... – N Dorigatti Sep 18 '17 at 10:26