HERE SDK for Android (Premium Edition)
SDK for Android Developer's Guide

Distance calculations between points

Calculating the absolute distance between two points

Following example explains how to calculate absolute distance between two points using the Haversine formula, ignoring any kind of roads or similar.

GeoCoordinate start = new GeoCoordinate(49.839740, 24.029272);
GeoCoordinate end = new GeoCoordinate(49.843667, 24.026510);
// distance in meters
double distance = start.distanceTo(end);

Calculating the distance along a route

Following example explains how to calculate distance along a route. Use particular route options to get needed route.

// create route plan and set waypoints
RoutePlan routePlan = new RoutePlan();
RouteWaypoint start = new RouteWaypoint(new GeoCoordinate(49.839882, 24.029239));
RouteWaypoint destination = new RouteWaypoint(new GeoCoordinate(49.849897, 24.022307));

// set route options
RouteOptions routeOptions = new RouteOptions();

// calculate route
CoreRouter router = new CoreRouter();
router.calculateRoute(routePlan, new Router.Listener<List<RouteResult>, RoutingError>() {
  public void onProgress(int percentage) {
    // show progress bar for long routes in offline mode

  public void onCalculateRouteFinished(@Nullable List<RouteResult> response,
                     @NonNull RoutingError error) {
    if (error == RoutingError.NONE && response != null && !response.isEmpty()) {
      // length in meters
      int length = response.get(0).getRoute().getLength();