Fleet Connectivity

The Fleet Connectivity features allows applications that use the 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: The 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 developer.here.com.

FleetConnectivityService

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 a minimum, 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:

Start the fleet connectivity service and begin listening for fleet connectivity events.

FleetConnectivityService service = FleetConnectivityService.getInstance();
service.setDispatcherId("Driver-321");
service.setAssetId("Truck-987");
if (service.start()) {
// service has started
} else {
// service has failed to start
}

Implement Listener. Once a message is received, check if it is a dispatch job.

In the previous steps, after sending each event, your application receives an acknowledgment from the dispatching server through the onEventAcknowledged(FleetConnectivityEvent, FleetConnectivityError) callback.