我在 Mapbox sdk 中工作,我集成了 sdk,我可以在触摸地图时显示当前位置和放置图钉。
但是当我调用导航路线时,它会给我一条错误消息“无法在后端发出请求”。任何机构都知道它为什么显示此消息?我需要付费 Mapbox 帐户吗?
我正在使用以下代码。
NavigationRoute.builder(this)
.accessToken(Mapbox.getAccessToken())
.origin(origin)
.destination(destination)
.build()
.getRoute(new Callback<DirectionsResponse>() {
@Override
public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
if (response.body()==null){
Log.e(TAG,"No route found check accesstoker and user");
System.out.println("msgs " +"1");
return;
}else if (response.body().routes().size()==0){
Log.e(TAG,"No route found ");
System.out.println("msgs " +"2");
return;
}
DirectionsRoute currentRoute=response.body().routes().get(0);
currentRouts=currentRoute;
if (navigationMapRoute!=null){
navigationMapRoute.removeRoute();
}else{
navigationMapRoute=new NavigationMapRoute(null,mapView,map);
}
navigationMapRoute.addRoute(currentRoute);
}
@Override
public void onFailure(Call<DirectionsResponse> call, Throwable t) {
System.out.println("msgs " +"23 "+t);
}
});