简体   繁体   English

Android - 如何通过路线路线导航?

[英]Android - How to navigate by Route Legs?

I'm building an app which will show route to the user to specific destination.我正在构建一个应用程序,它将向用户显示到特定目的地的路线。 I get the route from Google direction web service.我从谷歌方向网络服务获得路线。

But I don't understand how should I know in which leg the user is now?但我不明白我应该如何知道用户现在在哪条腿上? Or, which legs have already been passed?或者,哪条腿已经通过了?

The way to find out the leg in which user is currently positioned is to find the values in the steps[] array, if those steps match with another steps[] array in one of the leg than that particular leg is the one in which the user is currently located.找出用户当前所在的腿的方法是找到 steps[] 数组中的值,如果这些步骤与一条腿中的另一个 step[] 数组匹配,而不是该特定腿是用户当前所在位置。

Code logic would have some conditional if else statement where a check would be made to figure out the steps in one of the leg fetched from the API and the steps user currently is.代码逻辑将有一些条件 if else 语句,其中将进行检查以找出从 API 获取的一条腿中的步骤以及用户当前所在的步骤。

Hope that Helps!!希望有帮助!!

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

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