相关疑难解决方法(0)

如何获取从当前位置到下一步的距离、方向、持续时间?

我正在使用 Mapbox Android SDK

compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:3.0.0@aar').

我之前在这里问过类似的问题,但仍然有一些问题。拿到currentRoute的时候不知道怎么实现。我的代码如下:

private Waypoint lastCorrectWayPoint;
private boolean checkOffRoute(Waypoint target) {
    boolean isOffRoute = false;
    if(currentRoute != null){
        if (currentRoute.isOffRoute(target)) {
            showMessage("You are off-route, recalculating...");
            isOffRoute = true;
            lastCorrectWayPoint = null;
            //would recalculating route.
        } else {
            lastCorrectWayPoint = target;
            String direction = "Turn right"; //The message what should I prompt to user
            double distance = 0.0;//The distance which from target to next step.
            int duration = 0;//The time which from target to …
Run Code Online (Sandbox Code Playgroud)

java android mapbox

2
推荐指数
1
解决办法
1490
查看次数

标签 统计

android ×1

java ×1

mapbox ×1