Hi everyone! I'm getting not detailed error while i was trying to draw a route path. Error is: com.esri.arcgisruntime.io.JsonEmbeddedException: Unable to complete operation. can anyone help me! thanks.. public void drawShortestPath(final Point startPoint, final Point endPoint) {
// create RouteTask instance
mRouteTask = new RouteTask(getContext(), getString(R.string.routing_service));
UserCredential credential = new UserCredential(getContext().getResources().getString(R.string.arcgis_username), getContext().getResources().getString(R.string.arcgis_password));
mRouteTask.setCredential(credential);
setupSymbols(startPoint, endPoint);
final ListenableFuture<RouteParameters> listenableFuture = mRouteTask.createDefaultParametersAsync();
listenableFuture.addDoneListener(new Runnable() {
@Override
public void run() {
try {
if (listenableFuture.isDone()) {
int i = 0;
mRouteParams = listenableFuture.get();
// create stops
Stop stop1 = new Stop(startPoint);
Stop stop2 = new Stop(endPoint);
List<Stop> routeStops = new ArrayList<>();
// add stops
routeStops.add(stop1);
routeStops.add(stop2);
mRouteParams.setStops(routeStops);
// set return directions as true to return turn-by-turn directions in the result of getDirectionManeuvers().
mRouteParams.setReturnDirections(true);
// solve
final ListenableFuture<RouteResult> result = mRouteTask.solveRouteAsync(mRouteParams);
result.addDoneListener(new Runnable() {
@Override
public void run() {
try {
RouteResult res = result.get();
final List routes = res.getRoutes();
mRoute = (Route) routes.get(0);
// create a mRouteSymbol graphic
Graphic routeGraphic = new Graphic(mRoute.getRouteGeometry(), mRouteSymbol);
// add mRouteSymbol graphic to the map
mGraphicsOverlay.getGraphics().add(routeGraphic);
// get directions
// NOTE: to get turn-by-turn directions Route Parameters should set returnDirection flag as true
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
});
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
});
}
... View more