Android HMKit
HMKit is the access point for the Broadcaster and Telematics. It is also used to initialise the SDK with a Device Certificate and security keys.
Table of Contents
- Getting the instance
- Managing the SDK lifecycle
- initialise(DeviceCertificate, PrivateKey, PublicKey, Context)
- initialise(String, String, String, Context)
- initialise(Context)
- setDeviceCertificate(DeviceCertificate, PrivateKey, PublicKey)
- setDeviceCertificate(String, String, String,)
- terminate()
- Properties
- Certificate Management
Getting the instance
Returns the shared HMKit object.
Declaration
public static HMKit getInstance();
Returns
The shared HMKit object
Managing the SDK lifecycle
Discussion
The SDK needs to be initialised with necessary properties and terminated if not used anymore.
Initialise the SDK with a DeviceCertificate and crypto keys
Declaration
public void initialise(DeviceCertificate certificate, PrivateKey privateKey, PublicKey issuerPublicKey, Context ctx);
Parameters
certificate | The device certificate |
privateKey | 32 byte private key with elliptic curve Prime 256v1 |
issuerPublicKey | 64 byte public key of the Certificate Authority |
context | The application context |
Initialise the SDK with a DeviceCertificate and crypto keys in Base64 or Hex
Declaration
public void initialise(String certificate, String privateKey, String issuerPublicKey, Context ctx);
Parameters
certificate | The device certificate |
privateKey | 32 byte private key with elliptic curve Prime 256v1 |
issuerPublicKey | 64 byte public key of the Certificate Authority |
context | The application context |
Initialise the SDK with Application Context
Declaration
public void initialise(Context ctx);
Parameters
context | The application context |
Discussion
Initialise with context to access storage only. Call setDeviceCertificate() later to access Broadcaster and Telematics
Set a new Device Certificate
Declaration
public void setDeviceCertificate(DeviceCertificate certificate, PrivateKey privateKey, PublicKey issuerPublicKey);
Parameters
certificate | The device certificate |
privateKey | 32 byte private key with elliptic curve Prime 256v1 |
issuerPublicKey | 64 byte public key of the Certificate Authority |
Discussion
Before setting a new Device Certificate, SDK has to be initialised with Application Context
Read More
Set a new Device Certificate in Base64 or Hex
Declaration
public void setDeviceCertificate(String certificate, String privateKey, String issuerPublicKey,);
Parameters
certificate | The device certificate |
privateKey | 32 byte private key with elliptic curve Prime 256v1 |
issuerPublicKey | 64 byte public key of the Certificate Authority |
Discussion
Before setting a new Device Certificate, SDK has to be initialised with Application Context
Read More
Clear the SDK-s footprint
Declaration
public void terminate();
Discussion
Call this function when the SDK is not used anymore. For instance when killing the app. This clears the Bluetooth service and unregisters all BroadcastReceivers
Properties
The Broadcaster instance
Declaration
@Nullable public Broadcaster getBroadcaster();
Discussion
Null if BLE is physically not supported
The Telematics instance
Declaration
public Telematics getTelematics();
The Device Certificate
Declaration
public DeviceCertificate getDeviceCertificate();
Discussion
Device Dertificate is used by the broadcaster and telematics to identify themselves
Read More
SDK information string
Declaration
public String getInfoString();
Returns
An SDK description string containing version name and type(mobile or wear)
The logging level of the SDK
Loggin level values
Certificate Management
Discussion
Access Certificates are needed to identifiy the link between two devices, either via Bluetooth or Telematics.
Download an access certificate
Declaration
public void downloadAccessCertificate(String accessToken, final DownloadCallback callback);
Parameters
accessToken | The token that is used to download the certificate |
callback | A DownloadCallback object that is invoked after the download is finished or failed |
Discussion
The access token needs to be provided by the certificate provider
Read More
The Download Certificate callback
Declaration
public interface DownloadCallback {
void onDownloaded(DeviceSerial vehicleSerial);
void onDownloadFailed(DownloadAccessCertificateError error);
}
Discussion
DownloadCallback is used to notify the user about the certificate download result
Get all Access Certificates
Declaration
public AccessCertificate[] getCertificates();
Returns
All Access Certificates where this device's serial is providing access
Read More
Find an Access Certificate with the given serial
Declaration
public AccessCertificate getCertificate(DeviceSerial serial);
Parameters
serial | The serial number of the device that is gaining access |
Returns
An Access Certificate for the given serial if one exists, otherwise null
Read More
Delete an Access Certificate with the given serial
Declaration
public boolean deleteCertificate(DeviceSerial serial);
Parameters
serial | The serial number of the device that is gaining access |
Returns
true if the certificate existed and was deleted successfully, otherwise false
Deletes all the stored Access Certificates
Declaration
public boolean deleteCertificates();