我正在使用 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)