# Trip Manager Device Support

The trip manager can use devices associated to a vehicle to determine when you're driving that vehicle.

For example, the IMS Wedge wakes up when you start driving, remains active during the trip, and can be used to identify the vehicle.

{% hint style="info" %}
The addition of Bluetooth detection does not significantly affect battery consumption.
{% endhint %}

## Device Detector

The SDK uses background scanning to detect the presence of an associated device - even when the app isn't running. When this happens the trip manager automatically starts and moves into the verification phase.

To enable device detection, first identify and save the device(s) you're interested in, then add the following code to the trip manager configuration:

```kotlin
ImsTripManager.configureTripManager(context,ImsTripManager.Builder()
    .setTripDetectors(TripDetector.DEVICE /*, others */)
    // Additional configuration options
    .build() )
```

When device detection is used, the SDK automatically enables and disables background device detection as required.

{% hint style="info" %}
If you are using TripDetector.Device your app should **not** call DsDeviceManager's .enableBackgroundMonitor() or disableBackgroundMonitor() methods as these may interfere with the trip manager.
{% endhint %}

## Device Validator

The SDK uses the device validator to verify that an associated device is present during the trip.

* When the device is turned off, or goes out of range, the trip manager uses this to detect the end of a trip.
* Bluetooth devices have a significant range, so you may detect the start of a trip when someone else is driving but you're outside the vehicle. Ongoing device checks help the trip manager verify that you're actually in the vehicle.

To enable device detection, first identify and save the device(s) you're interested in, then add the following code to the trip manager configuration:

```kotlin
ImsTripManager.configureTripManager(context,ImsTripManager.Builder()
    .setTripValidators(TripValidator.DEVICE /*, others */)
    // Additional configuration options
    .build() )
```

## Vehicle Trip Identification

### Setup

To enable vehicle verification, first identify and save the device(s) you're interested in (with the vehicle ID field set), then add the following code to the trip manager configuration:

```kotlin
ImsTripManager.configureTripManager(context,ImsTripManager.Builder()
    .setTripTelemetry(TripTelemetry.VERIFIED_VEHICLE /*, others */)
    // Additional configuration options
    .build() )
```

When this is specified, a "verified vehicle" record is added to the trip file whenever an associated device is detected during the trip.

### Associate Vehicle to Device

Device detection can also be used to identify the vehicle by assigning a non-null string to the Device's vehicle ID attribute.

```kotlin
deviceFromScan.vehicleId = "{vehicleId}"
DsDeviceManager.associateDevice(context, deviceFromScan)
```

The trip recorder reports the vehicle ID to the DriveSync server as part of the trip file, so you can keep track of which vehicle made each trip.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk.ims.tech/readme/android/using-the-sdk/trip-detection-and-recording/trip-manager-configuration/trip-manager-device-support.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
