Introducing The Fleet SDK For The Auto API

April 15, 2021
We are today launching a new toolkit in our SDK suite for car data. The HMKit Fleet SDK is tailor-made for fleet owners and fleet operators who want to integrate telematics data from their vehicles without the need to install additional hardware.

One of the main differences for fleet owners compared to individual drivers is that data activation can be performed for the entire fleet through an API, instead of stepping through the consent flow user interface for each vehicle, one by one. Here is a full breakdown of the Fleet SDK functionality:

  • The SDK is written in Kotlin and supports the Java 8 runtime, making it suitable for anyone running Java in the backend.
  • Vehicles can be activated either one by one or in bulk transactions, through the fleet clearance functions.
  • To activate a vehicle, the vehicle’s VIN and current odometer reading has to be passed in. The odometer value is cross-checked against the actual value as a security control measure.
  • Data is retrieved through the SDK using the same Auto API data format used across all of our other SDKs.
  • Like all of our SDKs, HMKit Fleet is open source and published on GitHub under the MIT license.

As a prerequisite for using the Fleet SDK, a production application must be registered in our platform and designated as a fleet application, which can be done by following our guide.

Today, it is possible to retrieve data from BMW, MINI, and Mercedes-Benz fleets, and we will onboard additional manufacturers in the coming months. A compendium of available data can be found on our platform use-cases pages.

In this blog post, we describe the internals of the library; at the bottom, you can find download links and further resources to get started with the Fleet SDK.

How the Fleet SDK works

It is already possible to integrate fleet data by consuming APIs directly from our platform, a process described in the Fleet Clearance tutorial. The Fleet SDK combines the use of three different APIs:

  1. The Service Account API, which is used to queue vehicles to be cleared for data retrieval. Once a vehicle has received the clearance, it is possible to retrieve an Access Token to be used for data queries.
  2. The Telematics API, which is used both to query the latest cached data of a vehicle and to send commands such as Lock/Unlock. When not using the Fleet SDK, you would use our REST API or Node.js SDK to get the same work done.
  3. The OAuth2 API, which is used for revoking Access Tokens when access is no longer needed.

Instead of managing an integration of all three APIs, all that is needed for making use of the Fleet SDK is to initialise it with valid credentials from your account. How this is done, along with how the fleet clearance is done, is all documented in our Fleet SDK guide.

Here is an example of retrieving the speed of a vehicle. The open source Auto API Java library is used for both constructing commands and for parsing them.

After receiving the response from the server, the Auto API data can be parsed.

The above is a simple example. Some vehicles support up to a hundred different data points, and you can query them all in one request.

Getting started

Here is a full list of resources that can help you get started or further your understanding. We hope the Fleet SDK comes in handy and we would love to hear your feedback on it.