Move marker with gps in google map android

前端 未结 8 788
悲&欢浪女
悲&欢浪女 2020-12-15 19:31

I want to make move of the marker in GOOGLE MAP while gps location changes just like in UBER app. I have found some solutions but unab

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 20:19

    If you're still looking for the solution, hope this https://www.youtube.com/watch?v=WKfZsCKSXVQ will help you. I've used this in one of my apps and it helps animating the marker from one location to other location. Source code can be grabbed here https://gist.github.com/broady/6314689.

    You might need to add rotation to your marker to show the exact direction of the marker. Following is the block of code that I'm using to find bearing.

        private float bearingBetweenLatLngs(LatLng begin, LatLng end) {
            Location beginL = convertLatLngToLocation(begin);
            Location endL = convertLatLngToLocation(end);
    
            return beginL.bearingTo(endL);
        }
    

提交回复
热议问题