About one week ago I started to get a "Response parsing problem" to calculate Custom Route (for anywhere) using Android Premium SDK. I am using the same code for a while but recently this error appears. So, I cannot calculate a custom route for anywhere ...
I checked developers site and could see that the documentation points the version 3.18 as the latest SDK version but I only can download the 3.17 version on my panel. Is it the problem? They have published another API and it's incompatible with the previous version? If is's so, where can I download the new version?
A little code of my own:
FTCRRouteOptions routeOptions = new FTCRRouteOptions();
routeOptions.setTransportMode(FTCRRouteOptions.TransportMode.CAR);
routeOptions.setRouteType(FTCRRouteOptions.Type.SHORTEST);
routeOptions.setUseTraffic(true);
FTCRRoutePlan routePlan = new FTCRRoutePlan(waypoints, routeOptions);
try {
FTCRRouter.Listener routerListener = new FTCRRouter.Listener() {
@Override
public void onCalculateRouteFinished(@NonNull List<FTCRRoute> list, @NonNull FTCRRouter.ErrorResponse errorResponse) {
if (errorResponse.getErrorCode() == RoutingError.NONE) {
if (list != null && list.size() > 0) {
route = list.get(0);
manobras = route.getManeuvers();
traduzir(manobras.get(0).getInstruction());
mapRoute = new FTCRMapRoute(route);
mapRoute.setColor(Color.rgb(34, 162, 229));
map.addMapObject(mapRoute);
gbb = route.getBoundingBox();
map.zoomTo(gbb, Map.Animation.NONE, Map.MOVE_PRESERVE_ORIENTATION);
pontoCentral = new PointF(map.getTransformCenter().x, (map.getTransformCenter().y * 85 / 50));
map.setTransformCenter(pontoCentral);
Image icone = new Image();
marcadorNavegacao = new MapMarker();
try {
icone.setImageResource(R.mipmap.pngegg);
marcadorNavegacao.setIcon(icone);
} catch (IOException ioe) {
}
mapFragment.getPositionIndicator().setVisible(false);
map.setCenter(waypoints.get(0).getNavigablePosition(), Map.Animation.NONE);
map.setZoomLevel(25, Map.Animation.NONE);
marcadorNavegacao.setVisible(true);
marcadorNavegacao.setCoordinate(map.getCenter());
map.addMapObject(marcadorNavegacao);
circulo = new MapCircle();
if (rotaAtual != null || rotasFiltradas != null) {
if (rotaAtual == null) {
rotaAtual = rotasFiltradas.get(0);
}
rotaEstatica = rotaAtual;
circulo.setCenter(map.getCenter());
circulo.setRadius(rotaAtual.SeqRaio);
circulo.setLineColor(Color.RED);
circulo.setFillColor(Color.argb(30, 255, 0, 0));
map.addMapObject(circulo);
}
tvRuaAtual.setVisibility(View.VISIBLE);
ivManobra.setVisibility(View.VISIBLE);
tvProximaRua.setVisibility(View.VISIBLE);
tvDistanciaProximaManobra.setVisibility(View.VISIBLE);
tvEmSeguida.setVisibility(View.VISIBLE);
ivProximaManobra.setVisibility(View.VISIBLE);
map.getMapTransitLayer().setMode(MapTransitLayer.Mode.EVERYTHING);
map.getMapTrafficLayer().setEnabled(MapTrafficLayer.RenderLayer.INCIDENT, true);
startingNavigation();
} else {
Toast.makeText(context, "Rota não encontrada", Toast.LENGTH_LONG).show();
}
} else {
if (errorResponse.getErrorCode() == RoutingError.VIOLATES_OPTIONS) {
Toast.makeText(getApplicationContext(), "Erro interno na HERE. Não é possível prosseguir", Toast.LENGTH_LONG).show();
} else {
try {
if (progressDialog != null) {
progressDialog.cancel();
}
Toast.makeText(context, "Erro ao calcular rota: " + errorResponse.getMessage(), Toast.LENGTH_LONG).show();
navegacaoAssistida(inicio, termino, waypoints);
} catch (Exception e) {
}
}
}
}
};
coreRouter.calculateRoute(routePlan, routerListener);
} catch (
Exception ex) {
Log.e("CoreRouter", ex.getLocalizedMessage());
}