public final class ZendriveVehicleTagging extends Object
All drives (automatically detected or manually started) will be tagged with the vehicleId
of an associated vehicle if the device was connected to its bluetooth during the drive.
The vehicleId
tag will be sent to the application as an entry in
the list of tags
of the AnalyzedDriveInfo
.
Only one vehicleId
will be used as a tag even if the device was connected to the
bluetooth of multiple associated vehicles.
Modifier and Type | Method and Description |
---|---|
static ZendriveVehicleTaggingOperationResult |
associateVehicle(Context context,
ZendriveVehicleInfo zendriveVehicleInfo)
Associate a vehicle with the SDK.
|
static ZendriveVehicleTaggingOperationResult |
dissociateVehicle(Context context,
String vehicleId)
Dissociate an associated vehicle from the SDK.
|
static String |
getAssociatedVehicleIdForDrive(DriveInfo driveInfo)
Get the vehicle id from the list of tags of the drive info returned in the drive callbacks.
|
static List<ZendriveVehicleInfo> |
getAssociatedVehicles(Context context)
Get the list of vehicles currently associated with ZendriveSDK.
|
public static ZendriveVehicleTaggingOperationResult associateVehicle(@NonNull Context context, @NonNull ZendriveVehicleInfo zendriveVehicleInfo)
Applications which want to tag a user's drives with the vehicle driven may use this call.
All drives (automatically detected or manually started) will be tagged with the
vehicleId
of an associated vehicle if the device was connected to the bluetooth of
the vehicle during the drive.
If a drive is already ongoing when this call is made, that drive will get tagged with the
vehicleId
if the vehicle was found connected after the call is made and before the
end of the drive.
Only two vehicles may be associated at a time.
The application must call dissociateVehicle
when it wants to
remove the vehicle.
context
- The context of the enclosing application.zendriveVehicleInfo
- The information of the vehicle to be associated with the Zendrive
SDK. Cannot be null.result
of the associateVehicle
operation.public static ZendriveVehicleTaggingOperationResult dissociateVehicle(@NonNull Context context, @NonNull String vehicleId)
The vehicle id of the vehicle dissociated will not be used to tag the drives.
If a drive is already on when this call is made, that drive will not be tagged with the
vehicle's vehicleId
.
The application must call associateVehicle
when it wants to add
this vehicle again.
context
- The context of the enclosing application.vehicleId
- The id of the vehicle to be dissociated from the
Zendrive SDK. Cannot be null.result
of the dissociateVehicle
operation.@Nullable public static List<ZendriveVehicleInfo> getAssociatedVehicles(@NonNull Context context)
If the SDK is set up, this method returns a list of ZendriveVehicleInfo
objects for
each vehicle currently associated.
If the SDK is not set up, null is returned.
context
- The context of the enclosing application.ZendriveVehicleInfo
objects for current associated vehicles.
Null is returned if the SDK is not setup.@Nullable public static String getAssociatedVehicleIdForDrive(@NonNull DriveInfo driveInfo)
AnalyzedDriveInfo
as an entry in the list of tags
.
If the device was not connected to the bluetooth of any associated vehicles during the drive, null is returned.
driveInfo
- The DriveInfo
from which the vehicleId
tag is to be fetched.vehicleId
of an associated vehicle which the device was connected to
during a drive, or null.