# MoveTripState

Returns the current user's driving state.

{% tabs %}
{% tab title="Android" %}

```kotlin
enum class MoveTripState {
    UNKNOWN,
    IDLE,
    DRIVING,
    HALT,
    IGNORED
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
enum MoveTripState {
    case unknown
    case driving
    case halt
    case idle
    case ignored
}
```

{% endtab %}

{% tab title="React Native" %}

```
export type TripState = 'unknown' | 'driving' | 'halt' | 'idle' | 'ignored';
```

{% endtab %}
{% endtabs %}

| MoveTripState |                                                                 |
| ------------- | --------------------------------------------------------------- |
| unknown       | SDK detection service didn't start.                             |
| idle          | Device is in idle.                                              |
| driving       | Device is actively driving in a  trip.                          |
| halt          | Device is holding position in a trip.                           |
| ignored       | Device is in a trip that is flagged as ignored by the host app. |

Trip goes through different states during the SDK's life cycle. Initially the [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) is `.unknown`, until the service is started.&#x20;

When service successfully starts, the [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) will transit to `.idle` state.

When the user starts driving a car or riding a bicycle (if [configured](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/moveconfig)), a trip will start and the [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) will transit to `.driving`. During the trip, the user could sometimes choose to go to *temporarily* idle (like in traffic jams, traffic stops, etc.), this is expressed through the `.halt` [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate). Halt state means that the user is in an active trip, but is currently stationary. As soon as the SDK detects that the user's trip has ended, [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) will transit back again to `.idle`.

While being on a trip, the host app can choose to ignore the ongoing trip using the `ignoreCurrentTrip` API ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/android-1/android#ignore-current-trip) / [iOS](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/ios#ignore-current-trip)). This will transit the [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) to `.ignored` [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate). Ignored trips are purged and not forwarded to the server or further processed.

| MoveTripState related APIs                                                                                                                                                                                                                                                              |                                                                                                                                                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `getTripState` ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/android-1/android#get-trip-state) / [iOS](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/ios#get-trip-state))                                                            | Gets the current [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) .                                |
| `setTripStateListener`([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/android-1/builder#DolphinSdk.Builderv1.1-tripstatelistenerTripstatelistener) / [iOS](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/ios#set-trip-state-listener)) | Provide a block to be invoked every time [MoveTripState](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/movetripstate) changes. |
| `finishCurrentTrip` ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/android-1/android#finish-current-trip) / [iOS](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/ios#finish-current-trip))                                             | Ends the current ongoing trip.                                                                                                                  |
| `ignoreCurrentTrip` ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/android-1/android#ignore-current-trip) / [iOS](https://docs.movesdk.com/move-platform/move-sdk-1.x/api-interface/ios#ignore-current-trip))                                             | Ignores the current ongoing trip.                                                                                                               |
