I am currently developing an Android App for navigation purposes. It is based on the ArcGIS Android API. I have an ArcGIS server (with network analyst module) with all the needed data running.

At the moment the App displays a map with the current position (point A) and has a search form, where you can search for a building (point B).

The next step would be to display a route from "point A" to "point B". Does anybody know if there is a way to do that natively with the Android API?

Also it would be possible to compute the routing information on a Java web service and then send it to the app, which only has to display it.

I cannot find any sample code on the ArcGIS resource page.

2 Answers 2


With the new version of ArcGIS Runtime SDK for Android, there is a sample project that makes route analysis.



Here is a snippet with ArcGIS Runtime SDK for Android 100.9.0.

public class NetworkUtils {

public Polyline routeResultGeometry = null;
public List<DirectionManeuver> routeResultDirections = null;

private Context _context;
private final String routeTaskNorthAmerica = "YOUR_NA_SERVER_ROUTE_URL";
private RouteTask _routeTask = null;
private RouteParameters _routeParameters = null;

public NetworkUtils(Context context, GraphicsOverlay routeGraphicsOverlay) {
    _context = context;
    _routeTask = new RouteTask(context, routeTaskNorthAmerica);
    _routeTask.addDoneLoadingListener(() -> {
        try {
            if (null == _routeTask.getLoadError() && _routeTask.getLoadStatus() == LoadStatus.LOADED) {
                // route task has loaded successfully
                _routeParameters = _routeTask.createDefaultParametersAsync().get();
                // set flags to return stops and directions

        } catch (Exception e) {
            Log.e("__Leo__", e.getMessage());

public void Solve() {

    Polyline routeGeometry = null;
    try {
        Stop stop1 = new Stop(new Point(-80.94125, 40.748));
        Stop stop2 = new Stop(new Point(-81.017414, 40.742380));
        _routeParameters.setStops(Arrays.asList(stop1, stop2));

        RouteResult result = _routeTask.solveRouteAsync(_routeParameters).get();
        final List routes = result.getRoutes();
        if (!routes.isEmpty()) {
            Route route = (Route) routes.get(0);
            routeResultGeometry = route.getRouteGeometry();
    } catch (Exception e) {
        Log.e("__Leo__", e.getMessage());
        Log.e("__Leo__", String.valueOf(e.getCause()));

private void SolveTest(GraphicsOverlay routeGraphicsOverlay) {

    if (null != routeResultGeometry) {
        SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLUE, 3);
        Graphic routeGraphic = new Graphic(routeResultGeometry, lineSymbol);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.