Class TelematicsSDK
- All Implemented Interfaces:
TelematicsSDKInterface
-
Method Summary
Modifier and TypeMethodDescriptionChecks the current permissions and returns a list of permissions that are not granted.voidClears the current vehicle information from the SDK.voidcorrectKilometers(int kilometers, String observations, int correctionCount, TelematicsCallback callback) Corrects the odometer reading for the vehicle by applying the given value to a specified number of past records.voidAsynchronously retrieves a map of vehicle add reasons supported by the SDK.voidgetChallengeGroupsRanking(int challengeId, TelematicsChallengeGroupsRankingCallback callback) voidgetChallengeMetrics(int challengeId, TelematicsChallengeMetricsCallback callback) voidgetChallenges(boolean isGroupChallenges, TelematicsChallengesCallback callback) voidgetCurrentUserInfo(TelematicsUserCallback callback) Retrieves the current user information and provides it via the callback.voidRetrieves the current telematics user information and provides it asynchronously via the givenTelematicsUserDetailsCallback.voidRetrieves the current vehicle information and provides it via the callback.voidRetrieves the details of the currently selected vehicle.doubleRetrieves the estimated current mileage for the vehicle in kilometers.voidgetFormTemplateByReference(String reference, TelematicsFormTemplateCallback callback) Retrieves a form template by its reference.voidgetFuelTypes(FuelTypesCallback callback) Asynchronously retrieves a map of fuel types supported by the SDK.static TelematicsSDKgetInstance(android.content.Context context) Returns the singleton instance of the Telematics SDK.voidvoidvoidgetMetricsSummary(String startDate, String endDate, TelematicsMetricsSummaryCallback callback) Retrieves a summary of metrics for the specified date range.voidRetrieves a list of required form templates.String[]Returns an array of Android permissions required by the SDK to function correctly.voidgetTrip(long id, TelematicsTripCallback callback) Retrieves the details of a specific trip by its unique ID.voidgetTrips(String startDate, String endDate, TelematicsTripsCallback callback) Retrieves a list of trips within the specified date range.voidgetVehicleTypes(VehicleTypesCallback callback) Asynchronously retrieves a map of vehicle types supported by the SDK.voidinitSDK(String clientId, String clientSecret, boolean isStaging, TelematicsCallback callback) Initializes the Telematics SDK with the provided credentials and environment.voidinitSDK(String client, String clientId, String clientSecret, boolean isStaging, TelematicsCallback callback) Initializes the Telematics SDK with the provided credentials and environment.voidinsertManualEvent(TelematicsManualEventType eventType) booleanChecks if battery optimization is disabled for the application, which is required for accurate tracking.booleanChecks if the telematics service is currently running.voidLogs in a user with the provided credentials and group information.voidlogout()Logs out the current user and stops the telematics service.voidreportKilometers(int kilometers, String observations, TelematicsCallback callback) Reports the current odometer reading for the vehicle.voidsaveFormTemplates(List<TelematicsFormTemplateItemResponse> telematicsFormTemplateItemResponses, TelematicsCallback callback) Saves the responses to form templates.voidsetServiceCode(String serviceCode, TelematicsCallback callback) Sets the service code for the telematics service.voidsetVehicle(String plate, TelematicsVehicleDetailsCallback callback) Sets the current vehicle by its license plate.voidsetVehicle(String plate, String internalPlate, int type, int addReason, int fuelType, TelematicsCallback callback) Sets the vehicle information with the specified details.voidstartTelematicsService(TelematicsServiceOptions options, TelematicsCallback callback) Starts the telematics service with the specified options.voidstartTelematicsService(String reason, String observations, TelematicsCallback callback) Starts the telematics service if the required user and vehicle information is available.voidstopTelematicsService(TelematicsCallback callback) Stops the telematics service.voidstopTelematicsService(TelematicsServiceOptions options, TelematicsCallback callback) Stops the telematics service with the specified options.
-
Method Details
-
getInstance
Returns the singleton instance of the Telematics SDK.- Parameters:
context- the application context used for initializing the SDK.- Returns:
- the singleton instance of the Telematics SDK.
-
getEstimatedMileage
public double getEstimatedMileage()Description copied from interface:TelematicsSDKInterfaceRetrieves the estimated current mileage for the vehicle in kilometers.This method returns the estimated mileage based on the data collected by the telematics service. If the telematics service is not running or insufficient data is available, it will return -1 to indicate that mileage estimation is not possible.
- Specified by:
getEstimatedMileagein interfaceTelematicsSDKInterface- Returns:
- The estimated mileage in kilometers as a
double; returns -1 if estimation is not possible.
-
getMetricsSummary
public void getMetricsSummary(String startDate, String endDate, TelematicsMetricsSummaryCallback callback) Description copied from interface:TelematicsSDKInterfaceRetrieves a summary of metrics for the specified date range.- Specified by:
getMetricsSummaryin interfaceTelematicsSDKInterface- Parameters:
startDate- The start date for retrieving metrics in the format "YYYY-MM-DDTHH:mm:ssZ" (ISO 8601 with timezone).endDate- The end date for retrieving metrics in the format "YYYY-MM-DDTHH:mm:ssZ" (ISO 8601 with timezone).callback- The callback to handle the metrics summary retrieval.
-
getLastTelematicsPeriodMetricsSummary
- Specified by:
getLastTelematicsPeriodMetricsSummaryin interfaceTelematicsSDKInterface
-
getLastTelematicsDayMetricsSummary
- Specified by:
getLastTelematicsDayMetricsSummaryin interfaceTelematicsSDKInterface
-
getChallenges
- Specified by:
getChallengesin interfaceTelematicsSDKInterface
-
getChallengeMetrics
- Specified by:
getChallengeMetricsin interfaceTelematicsSDKInterface
-
getChallengeGroupsRanking
public void getChallengeGroupsRanking(int challengeId, TelematicsChallengeGroupsRankingCallback callback) - Specified by:
getChallengeGroupsRankingin interfaceTelematicsSDKInterface
-
insertManualEvent
- Specified by:
insertManualEventin interfaceTelematicsSDKInterface
-
getTrips
Description copied from interface:TelematicsSDKInterfaceRetrieves a list of trips within the specified date range.- Specified by:
getTripsin interfaceTelematicsSDKInterface- Parameters:
startDate- The start date for filtering trips in the format "YYYY-MM-DDTHH:mm:ssZ" (ISO 8601 with timezone).endDate- The end date for filtering trips in the format "YYYY-MM-DDTHH:mm:ssZ" (ISO 8601 with timezone).callback- The callback interface to handle the response. - If successful, theTelematicsTripsCallback.onTelematicsTripsFetched(List<TelematicsTripResume>)method will be called with the list of trips. - If there is an error, theTelematicsTripsCallback.onError(TelematicsSDKException)method will be called with the error information.
-
getFormTemplateByReference
Description copied from interface:TelematicsSDKInterfaceRetrieves a form template by its reference.- Specified by:
getFormTemplateByReferencein interfaceTelematicsSDKInterface- Parameters:
reference- The unique reference identifier for the form template.callback- The callback to handle the form template retrieval.
-
getRequiredFormTemplates
Description copied from interface:TelematicsSDKInterfaceRetrieves a list of required form templates.- Specified by:
getRequiredFormTemplatesin interfaceTelematicsSDKInterface- Parameters:
callback- The callback to handle the retrieval of required form templates.
-
saveFormTemplates
public void saveFormTemplates(List<TelematicsFormTemplateItemResponse> telematicsFormTemplateItemResponses, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceSaves the responses to form templates.- Specified by:
saveFormTemplatesin interfaceTelematicsSDKInterface- Parameters:
telematicsFormTemplateItemResponses- A list of form template item responses to be saved.callback- The callback to handle the success or failure of the save operation.
-
getTrip
Description copied from interface:TelematicsSDKInterfaceRetrieves the details of a specific trip by its unique ID.- Specified by:
getTripin interfaceTelematicsSDKInterface- Parameters:
id- The unique identifier of the trip you want to retrieve.callback- The callback interface to handle the response. - If successful, theTelematicsTripCallback.onTelematicsTripFetched(TelematicsTripDetail)method will be called with the trip details. - If there is an error, theTelematicsTripCallback.onError(TelematicsSDKException)method will be called with the error information.
-
initSDK
public void initSDK(String client, String clientId, String clientSecret, boolean isStaging, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceInitializes the Telematics SDK with the provided credentials and environment.- Specified by:
initSDKin interfaceTelematicsSDKInterface- Parameters:
client- The client name provided for authentication.clientId- The client ID provided for authentication.clientSecret- The client secret provided for authentication.isStaging-trueto use the staging environment;falseto use the production environment.callback- The callback to handle the success or failure of the initialization process.
-
initSDK
public void initSDK(String clientId, String clientSecret, boolean isStaging, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceInitializes the Telematics SDK with the provided credentials and environment.- Specified by:
initSDKin interfaceTelematicsSDKInterface- Parameters:
clientId- The client ID provided for authentication.clientSecret- The client secret provided for authentication.isStaging-trueto use the staging environment;falseto use the production environment.callback- The callback to handle the success or failure of the initialization process.
-
getFuelTypes
Description copied from interface:TelematicsSDKInterfaceAsynchronously retrieves a map of fuel types supported by the SDK.The resulting map, where each key is the fuel type name and the corresponding value is its identifier code, is delivered via the provided
FuelTypesCallback.- Specified by:
getFuelTypesin interfaceTelematicsSDKInterface- Parameters:
callback- the callback that will receive the fuel types map on success or an error if retrieval fails.
-
getVehicleTypes
Description copied from interface:TelematicsSDKInterfaceAsynchronously retrieves a map of vehicle types supported by the SDK.The resulting map, where each key is the vehicle type name and the corresponding value is its identifier code, is delivered via the provided
VehicleTypesCallback.- Specified by:
getVehicleTypesin interfaceTelematicsSDKInterface- Parameters:
callback- the callback that will receive the vehicle types map on success or an error if retrieval fails.
-
getAddVehicleReasons
Description copied from interface:TelematicsSDKInterfaceAsynchronously retrieves a map of vehicle add reasons supported by the SDK.The resulting map, where each key is the vehicle add reason name and the corresponding value is its identifier code, is delivered via the provided
AddVehicleReasonsCallback.- Specified by:
getAddVehicleReasonsin interfaceTelematicsSDKInterface- Parameters:
callback- the callback that will receive the vehicle add reasons map on success or an error if retrieval fails.
-
getRequiredPermissions
Description copied from interface:TelematicsSDKInterfaceReturns an array of Android permissions required by the SDK to function correctly.- Specified by:
getRequiredPermissionsin interfaceTelematicsSDKInterface- Returns:
- An array of required permission strings (e.g.,
android.Manifest.permission.ACCESS_FINE_LOCATION).
-
checkPermissions
Description copied from interface:TelematicsSDKInterfaceChecks the current permissions and returns a list of permissions that are not granted.- Specified by:
checkPermissionsin interfaceTelematicsSDKInterface- Returns:
- A list of missing permission strings that are required by the SDK but not granted.
-
login
public void login(String id, String extraID, String group, String serviceId, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceLogs in a user with the provided credentials and group information.- Specified by:
loginin interfaceTelematicsSDKInterface- Parameters:
id- The unique identifier for the user.extraID- An additional user identifier, if applicable.group- The group code or name the user belongs to.serviceId- The service ID associated with the user.callback- The callback to handle the success or failure of the login process.
-
setVehicle
public void setVehicle(String plate, String internalPlate, int type, int addReason, int fuelType, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceSets the vehicle information with the specified details.- Specified by:
setVehiclein interfaceTelematicsSDKInterface- Parameters:
plate- The vehicle's license plate number.internalPlate- An internal identifier or secondary plate for the vehicle.type- The vehicle type identifier code (as returned byTelematicsSDKInterface.getVehicleTypes(VehicleTypesCallback)).addReason- The reason identifier code for adding the vehicle (as returned byTelematicsSDKInterface.getAddVehicleReasons(AddVehicleReasonsCallback)).fuelType- The fuel type identifier code (as returned byTelematicsSDKInterface.getFuelTypes(FuelTypesCallback)).callback- The callback to handle the success or failure of setting the vehicle information.
-
setVehicle
Description copied from interface:TelematicsSDKInterfaceSets the current vehicle by its license plate.This method attempts to retrieve the vehicle associated with the provided license plate. If the vehicle exists, its details will be returned through the given callback. If the vehicle is not found, the callback will receive an appropriate error.
- Specified by:
setVehiclein interfaceTelematicsSDKInterface- Parameters:
plate- The license plate number of the vehicle to be set.callback- The callback used to return the vehicle details if found, or an error if not.
-
getCurrentVehicleInfo
Description copied from interface:TelematicsSDKInterfaceRetrieves the details of the currently selected vehicle.The current vehicle information is provided asynchronously through the supplied callback. If no vehicle has been set, the callback will return an error.
- Specified by:
getCurrentVehicleInfoin interfaceTelematicsSDKInterface- Parameters:
callback- The callback used to return the current vehicle details or an error if unavailable.
-
clearVehicle
public void clearVehicle()Description copied from interface:TelematicsSDKInterfaceClears the current vehicle information from the SDK.- Specified by:
clearVehiclein interfaceTelematicsSDKInterface
-
setServiceCode
Description copied from interface:TelematicsSDKInterfaceSets the service code for the telematics service.- Specified by:
setServiceCodein interfaceTelematicsSDKInterface- Parameters:
serviceCode- The service code to be used by the telematics service.callback- The callback to handle the success or failure of setting the service code.
-
isTelematicsServiceRunning
public boolean isTelematicsServiceRunning()Description copied from interface:TelematicsSDKInterfaceChecks if the telematics service is currently running.- Specified by:
isTelematicsServiceRunningin interfaceTelematicsSDKInterface- Returns:
trueif the telematics service is running;falseotherwise.
-
logout
public void logout()Description copied from interface:TelematicsSDKInterfaceLogs out the current user and stops the telematics service.- Specified by:
logoutin interfaceTelematicsSDKInterface
-
getCurrentVehicleInfo
Description copied from interface:TelematicsSDKInterfaceRetrieves the current vehicle information and provides it via the callback.- Specified by:
getCurrentVehicleInfoin interfaceTelematicsSDKInterface- Parameters:
callback- The callback to receive the current vehicle information.
-
getCurrentUserInfo
Description copied from interface:TelematicsSDKInterfaceRetrieves the current telematics user information and provides it asynchronously via the givenTelematicsUserDetailsCallback.Use this variant when you need access to the full
TelematicsUserDetailsobject, including fields such asid,name,group, andnickname.- Specified by:
getCurrentUserInfoin interfaceTelematicsSDKInterface- Parameters:
callback- the callback that will receive the detailed user information or an error if the retrieval fails
-
getCurrentUserInfo
Description copied from interface:TelematicsSDKInterfaceRetrieves the current user information and provides it via the callback.- Specified by:
getCurrentUserInfoin interfaceTelematicsSDKInterface- Parameters:
callback- The callback to receive the current user information.
-
startTelematicsService
Description copied from interface:TelematicsSDKInterfaceStarts the telematics service with the specified options.This method allows providing a
TelematicsServiceOptionsinstance to configure the behavior of the telematics service startup. The callback is used to notify whether the service was successfully started or if an error occurred.- Specified by:
startTelematicsServicein interfaceTelematicsSDKInterface- Parameters:
options- the options to configure how the telematics service should be started; must not benull.callback- the callback to handle the success or failure of starting the telematics service; must not benull.
-
startTelematicsService
Description copied from interface:TelematicsSDKInterfaceStarts the telematics service if the required user and vehicle information is available.This method validates that all necessary user and vehicle details are provided before initiating the telematics service. It logs the specified reason and any additional observations for auditing or troubleshooting purposes. The provided callback is then used to notify the caller whether the service was successfully started or if an error occurred.
- Specified by:
startTelematicsServicein interfaceTelematicsSDKInterface- Parameters:
reason- the reason for starting the telematics service, used for logging or auditing purposes; can be null or empty.observations- additional observations or comments related to starting the telematics service; may be an empty string if no extra information is available.callback- the callback to handle the success or failure of starting the telematics service;
-
stopTelematicsService
Description copied from interface:TelematicsSDKInterfaceStops the telematics service with the specified options.This method allows providing a
TelematicsServiceOptionsinstance to configure the behavior of the telematics service shutdown. The callback is used to notify whether the service was successfully stopped or if an error occurred.- Specified by:
stopTelematicsServicein interfaceTelematicsSDKInterface- Parameters:
options- the options to configure how the telematics service should be stopped; must not benull.callback- the callback to handle the success or failure of stopping the telematics service; must not benull.
-
stopTelematicsService
Description copied from interface:TelematicsSDKInterfaceStops the telematics service.- Specified by:
stopTelematicsServicein interfaceTelematicsSDKInterface- Parameters:
callback- The callback to handle the success or failure of stopping the telematics service.
-
isBatteryOptimizationDeactivated
public boolean isBatteryOptimizationDeactivated()Description copied from interface:TelematicsSDKInterfaceChecks if battery optimization is disabled for the application, which is required for accurate tracking.- Specified by:
isBatteryOptimizationDeactivatedin interfaceTelematicsSDKInterface- Returns:
trueif battery optimization is disabled for the app;falseotherwise.
-
correctKilometers
public void correctKilometers(int kilometers, String observations, int correctionCount, TelematicsCallback callback) Description copied from interface:TelematicsSDKInterfaceCorrects the odometer reading for the vehicle by applying the given value to a specified number of past records.- Specified by:
correctKilometersin interfaceTelematicsSDKInterface- Parameters:
kilometers- The corrected odometer reading in kilometers.observations- Any observations or comments related to the correction.correctionCount- The number of past records to which the correction should be applied.callback- The callback to handle the success or failure of the correction operation.
-
reportKilometers
Description copied from interface:TelematicsSDKInterfaceReports the current odometer reading for the vehicle.- Specified by:
reportKilometersin interfaceTelematicsSDKInterface- Parameters:
kilometers- The current odometer reading in kilometers.observations- Any observations or comments to include with the report.callback- The callback to handle the success or failure of the reporting operation.
-