HERE Android SDK Developer's Guide

Offline Routing

Even without an active data connection, the applications developed with the HERE Android SDK are able to request routing information to assist travelling from one location to another.

Your application's users do not need to maintain active, data connections to calculate routes and render them on a map. It is possible to pre-download updated maps and database information for initiating routing requests while offline. For example, if a user has downloaded offline maps of California and Oregon, a route from San Diego to Portland can be created without any data connection.

For more information about downloading offline maps, refer to Offline Maps (MapLoader).

Force Online or Offline

You can launch online or offline routing without changing the device or the HERE SDK connectivity by using the setConnectivity(Connectivity) method on a CoreRouter instance. Connectivity has three possible values:
  • If you launch a request using the DEFAULT connectivity mode, the request is performed according to the MapEngine connectivity setting. If the device is offline while MapEngine is set to online mode, the request fails.
  • If you launch a request using the ONLINE connectivity mode, an online request is performed, regardless of the MapEngine connectivity setting.
  • If you launch a request using the OFFLINE connectivity mode, an offline request is performed using cached data, regardless of the MapEngine connectivity setting.
In all cases, if the request fails, no fallback action is automatically performed.

To ensure that the connectivity mode is applied, call setConnectivity(Connectivity) before launching a CoreRouter calculation request. If a Connectivity.ONLINE route calculation request fails due to connection issues, the HERE SDK returns the RoutingError.NETWORK_COMMUNICATION error code. If a Connectivity.OFFLINE route calculation request fails due to not enough cached data, the HERE SDK returns the RoutingError.GRAPH_DISCONNECTED error code.

Note: This feature is only applicable to car, bicycle, truck, and pedestrian routing through the CoreRouter class.