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

Fleet Connectivity

The Fleet Connectivity features allow applications that use SDK for Android to receive job dispatches from a fleet dispatcher. Each job dispatch contains custom information such as a geocoordinate to a destination that can be used by your application for navigation or other purposes.

Your application, which is known as an asset in a fleet connectivity context, can also use this feature to indicate its job status to the dispatcher. These job statuses include whether it is available to receive a job, whether the job was accepted, and whether the job is finished.

Note: SDK for Android contains APIs for you to implement a fleet connectivity client. For instructions on how to use the fleet dispatcher features see the Fleet Connectivity Extension Developer's Guide at


This singleton class holds information such as this fleet asset ID, the fleet dispatcher to connect to, the running job, and job event polling interval.

Note: At least you must set the fleet asset and dispatcher IDs before starting the fleet connectivity service.

FleetConnectivityEvent and FleetConnectivityService.Listener

You can set a FleetConnectivityService.Listener to the service to listen for dispatcher events. Dispatcher events are highly customizable with the only mandatory information being a Job ID. Otherwise, you can define any type of information in its content payload such as a set of geocoordinates, a Place ID, or an address string.

There are two methods that need to be implemented in Listener:
  • onMessageReceived(FleetConnectivityMessage)
  • onEventAcknowledged(FleetConnectivityEvent, FleetConnectivityError)

Using the Fleet Connectivity Feature

The basic flow of how to use the Fleet Connectivity feature is as follows:
  1. Start the fleet connectivity service and begin listening for fleet connectivity events.
    FleetConnectivityService service = FleetConnectivityService.getInstance();
    if (service.start()) {
      // service has started
    } else {
      // service has failed to start
  2. Implement Listener. Once a message is received, check if it is a dispatch job.
    public void onMessageReceived(FleetConnectivityMessage message) {
      if (message.getMessage() != null) {
        // Display the optional message content
      if (message instanceof FleetConnectivityJobMessage) {
        // This message represents a job
        FleetConnectivityJobMessage newDestinationMessage =
          (FleetConnectivityJobMessage) message;
        // Get job ID from newDestinationMessage.getJobId()
        // Get location (in your preferred format) from
        // newDestinationMessage.getMessage()
        // Get threshold from newDestinationMessage.getEtaThreshold()
        // (this threshold controls when ETA updates are sent back to dispatcher)
      } else if (message instanceof FleetConnectivityCustomMessage) {
        // This message does not represent a job
        FleetConnectivityCustomMessage customMessage =
          (FleetConnectivityCustomMessage) message;
        // Get job ID from customMessage.getJobId()
        // Get message from customMessage.getContent()
  3. Send an event to the dispatcher that the job has been accepted.
    FleetConnectivityJobStartedEvent event =
      new FleetConnectivityJobStartedEvent();
    // populate event.setJobId(String)
    // populate event.setEtaThreshold(long)
    if (FleetConnectivityService.getInstance().sendEvent(event)) {
      // job is running
      // for example, your application can begin navigating to the job destination
    } else {
      // job has failed to start
    Alternatively, you can also reject the job by sending a rejection event.
    FleetConnectivityJobRejectedEvent event =
      new FleetConnectivityJobRejectedEvent();
    // populate event.setJobId(String)
    if (!FleetConnectivityService.getInstance().sendEvent(event)) {
      // failed to reject job
  4. While a job is in the accepted state, you can tell the dispatcher that the job is canceled.
    FleetConnectivityJobCancelledEvent event = new FleetConnectivityJobCancelledEvent();
    if (!FleetConnectivityService.getInstance().sendEvent(event)) {
      // failed to cancel job
  5. Upon job completion, notify the server that the job is finished. For example, you can choose to send this event when your application has successfully finished the navigation session.
    FleetConnectivityJobFinishedEvent event = new FleetConnectivityJobFinishedEvent();
    if (!FleetConnectivityService.getInstance().sendEvent(event)) {
      // failed to mark job as finished
  6. In the previous steps after sending each event your application receives an acknowledgment from the dispatching server through the onEventAcknowledged(FleetConnectivityEvent, FleetConnectivityError) callback.
    public void onEventAcknowledged(FleetConnectivityEvent event, FleetConnectivityError error)
      if (event instanceof FleetConnectivityJobStartedEvent) {
        // the job start event is acknowledged
      } else if (event instanceof FleetConnectivityJobRejectedEvent) {
        // the job rejection event is acknowledged
      } else if (event instanceof FleetConnectivityJobFinishedEvent) {
        // the job completion event is acknowledged
      } else if (event instanceof FleetConnectivityJobCancelledEvent) {
        // the job cancellation event is acknowledged
      } else if (event instanceof FleetConnectivityCustomEvent) {
        // the custom event is acknowledged
  7. Stop the service by calling FleetConnectivityService.getInstance().stop().