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
will be sent to the application as a part of
DriveInfo.vehicleTaggingDetails
.
A maximum of ten vehicles can be associated with the SDK using bluetooth car stereo.
Use DriveInfo.vehicleTaggingDetails
to get the details of vehicle tagged.
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 List<ZendriveVehicleInfo> |
getAssociatedVehicles(Context context)
Get the list of vehicles currently associated with the Zendrive SDK.
|
static List<BluetoothDevice> |
getBluetoothPairedDevices(Context context)
Get the list of all paired bluetooth devices.
|
static void |
getNearbyBeacons(Context context,
UUID uuid,
Integer major,
Integer minor,
ZendriveBeaconScanCallback beaconScanCallback)
Scans for beacons in the proximity.
|
static boolean |
isBleScanSupported(Context context)
Checks if the bluetooth low energy scanning is supported by the device hardware.
|
public static ZendriveVehicleTaggingOperationResult associateVehicle(@NonNull Context context, @NonNull ZendriveVehicleInfo zendriveVehicleInfo)
Applications which want to tag a user's drives with the vehicle driven may call this.
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 ten 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 List<BluetoothDevice> getBluetoothPairedDevices(Context context)
context
- The context of the enclosing application.BluetoothDevice
objects currently paired with the device.
Null is returned if the operation fails.public static void getNearbyBeacons(Context context, @NonNull UUID uuid, @Nullable Integer major, @Nullable Integer minor, @NonNull ZendriveBeaconScanCallback beaconScanCallback)
The SDK scans for the beacons identified using the uuid
, major
and
minor
and checks for the result every 5 seconds. The major
and minor
here are optional parameters.
If the list of scanned beacons is not empty, the same is returned
via the callback and the scan is stopped, otherwise, the scan continues.
The scanning is done upto a period of 30 seconds in case no beacons matching the identifiers
are found in the proximity, after which the scan is stopped, and an empty list is returned
via the callback.
ZendriveBeaconScanCallback
callback is used to return a list of
ZendriveScannedBeaconInfo
identified by unique uuid
, major
and minor
along with the result of the operation.
Callback will be made on calling thread if its Looper
is already
prepared, else the callback is made on the Main Thread.
context
- The context of the enclosing application.uuid
- The UUID component of the beacon identifier.
A valid UUID string contains of 32 hexadecimal digits,
split into 5 groups, separated by hyphens.
Ex: f7826da6-4fa2-4e98-8024-bc5b71e0893e
The purpose of the UUID is to distinguish the target beacon from all other beacons in the proximity.
major
- Major component of the iBeacon identifier. Its value can be in
the range [0, 65535]. This parameter is optional.minor
- Minor component of the iBeacon identifier. Its value can be in
the range [0, 65535]. This parameter is optional.beaconScanCallback
- Called with the result of the scanning operation and the list
of scanned beacons.
If the scan fails to start due to any reason, the error is
returned via the callback and the list of beacons returned
along with it is null. Otherwise,
ZendriveVehicleTaggingOperationResult.SUCCESS
is returned as the result of the operation along with the list
of beacons which can be empty or non-empty based on if any
beacon is found in the proximity.
public static boolean isBleScanSupported(Context context)
context
- The context of the enclosing application.