Package com.sentilant.telematicssdk
Interface TelematicsVehicleCallback
public interface TelematicsVehicleCallback
A callback interface to handle events related to the fetching of vehicle information
within the Telematics SDK. Implement this interface to receive notifications
when vehicle data is fetched or if an error occurs during the fetch operation.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when an error occurs while fetching the vehicle information.voidonTelematicsVehicleFetched(String plate, int type, int kms) Called when vehicle information has been successfully fetched.
-
Method Details
-
onTelematicsVehicleFetched
Called when vehicle information has been successfully fetched. Implement this method to handle the received vehicle data.- Parameters:
plate- the license plate of the vehicle. It is a string representing the unique identifier of the vehicle.type- the type of the vehicle. It is an integer representing the type of vehicle, such as car, truck, or motorcycle. This should correspond to predefined vehicle type constants.kms- the total kilometers driven by the vehicle. It is an integer representing the vehicle's mileage. This value indicates how far the vehicle has traveled.Example usage:
telematicsSDK.getCurrentVehicleInfo(new TelematicsVehicleCallback() { @Override public void onTelematicsVehicleFetched(String plate, int type, int kms) { // Handle the fetched vehicle data, such as updating the UI System.out.println("Vehicle Plate: " + plate); System.out.println("Vehicle Type: " + type); System.out.println("Vehicle Kilometers: " + kms); } @Override public void onError(TelematicsSDKException e) { // Handle the error, such as displaying an error message to the user System.err.println("Error fetching vehicle data: " + e.getMessage()); } });
-
onError
Called when an error occurs while fetching the vehicle information. Implement this method to handle the error appropriately.- Parameters:
e- the exception that occurred. It is an instance ofTelematicsSDKExceptionrepresenting the error that happened during the fetch operation.Example usage:
telematicsSDK.getCurrentVehicleInfo(new TelematicsVehicleCallback() { @Override public void onTelematicsVehicleFetched(String plate, int type, int kms) { // Handle the fetched vehicle data, such as updating the UI System.out.println("Vehicle Plate: " + plate); System.out.println("Vehicle Type: " + type); System.out.println("Vehicle Kilometers: " + kms); } @Override public void onError(TelematicsSDKException e) { // Handle the error, such as displaying an error message to the user System.err.println("Error fetching vehicle data: " + e.getMessage()); } });
-