简体   繁体   English

Android应用中的路线API实时跟踪

[英]Directions API Live tracking in android app

I am trying to use google maps directions API with continuous hitting to the API and updating the directions by getting a current location on location changed listener and it works perfectly. 我正在尝试使用谷歌地图方向API,持续点击API并通过获取位置更改的听众的当前位置更新方向,它的工作完美。

But Instead of hitting multiple times I need to get directions API for the single instance and write an algorithm by getting the directions using segments start point and update on google map, Find a way to know the user is traveling in the wrong distance and re-route map by calling API.I tried these ways and working but there are a lot of cases to be handled for these scenarios. 但是,我不需要多次点击,而是需要获取单个实例的路线API,并通过使用段起点和谷歌地图上的更新来获取路线,找到一种方法来了解用户在错误的距离内行驶并重新通过调用API路由映射。我尝试了这些方法和工作,但有很多情况需要处理这些方案。

I don't understand what to follow and why this is required is, we have a display cycle and the user starts the navigation and directions should be shown on cycle hardware display via BLE. 我不明白要遵循什么以及为什么需要这样做,我们有一个显示周期,用户开始导航,并且应该通过BLE在循环硬件显示上显示方向。

Please help me solving this issue. 请帮我解决这个问题。

You can try using the Google Maps Util Library . 您可以尝试使用Google Maps Util Library The PolyUtils class has methods to check if a LatLng lies on a polygon/polyline. PolyUtils类具有检查LatLng位于多边形/折线上的方法。

Maybe try using the method isLocationOnPath . 也许尝试使用方法isLocationOnPath And if it's outside the polyline, make the request to directions API and re-plot the route. 如果它在折线之外,请向Directions API发出请求并重新绘制路线。

Docs: http://googlemaps.github.io/android-maps-utils/javadoc/ 文档: http//googlemaps.github.io/android-maps-utils/javadoc/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM