App registration
It’s possible to register a customer’s application on a remote server using the methods provided by the SDK.
For the registration functionality to work, the SDK must be supplied with a configuration file containing the “service_id” field. See SDK configuration file generation for details.
The following functionality is supported:
Setting application details via the
setAppDetails()
method, including:Application name
Application version
Additional information about the app
Setting user details via the
setUserDetails()
method, including:Name
Email
Mobile phone number
Additional information about the customer
Setting vehicle details via the
setVehicleDetails()
method, including:Vehicle Identification Number (VIN)
Serial number
Part number
RTO number (for India)
Additional information about the vehicle
The registration process consists of the following steps:
Obtaining an API key using an account authentication token
Setting the application details
Setting the user details or the vehicle details
When the SDK has all the data needed for registration, it will automatically submit a request to the registration server, retrying in case of errors.
It’s possible to add a listener to be notified about the registration process via the Sdk.addAppRegistrationListener()
method (or remove it using the Sdk.removeAppRegistrationListener()
method).
Example:
Sdk.obtainApiKey(
"<account_authentication_token>",
new ObtainApiKeyWithAccountAuthenticationTokenListener() {
@Override
public void onApiKeyObtained(String apiKey, String newAccountAuthenticationToken) {
// Store the API key and the new token (if present)
}
@Override
public void onObtainApiKeyFailed(int errorCode, String errorMessage) {
// Handle the error
}
});
// ...
// Initialize the SDK
// ...
// Register the app:
Sdk.getInstance().setAppDetails("customerApp", "v1.2.3", "customer app additional information");
VehicleDetails vehicleDetails = new VehicleDetails(
"vin12345",
"sn12345",
"rto12345",
"part12345",
"otherInfo123456"
);
Sdk.getInstance().setVehicleDetails("<account_id>", vehicleDetails);