# DrivingInsightsApi

Use this API to receive driving insights about vehicular transports.

## DrivingInsightsApi API

### `getAverageOverallSafetyScore()`

> ```java
> @Nullable Float getAverageOverallSafetyScore(SafetyScoreRequestParameters params);
> ```
>
> Returns the average overall safety score for a given set of parameters, or `null` if the score is not available.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="240">Parameters</th><th></th></tr></thead><tbody><tr><td>params</td><td>The parameters for which to calculate the average overall safety score. See <a href="safetyscorerequestparameters">SafetyScoreRequestParameters</a>.</td></tr></tbody></table>

### `getCallEvents()`

> ```java
> List<CallEvent> getCallEvents(String transportId);
> ```
>
> Returns the [call events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/callevent) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

### `getCallWhileMovingEvents()`

{% hint style="warning" %}
This method was deprecated in v6.20.0 in favor of [getCallEvents()](#getcallevents).
{% endhint %}

> ```java
> List<CallWhileMovingEvent> getCallWhileMovingEvents(String transportId);
> ```
>
> Returns the [call while moving events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/callwhilemovingevent) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="240">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `getDrivingInsights()`

> ```java
> @Nullable DrivingInsights getDrivingInsights(String transportId)
> ```
>
> Returns the [driving insights](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/drivinginsight) for a given non-provisional transport, or `null` if there are no driving insights, the transport ID is invalid, or the transport is a provisional one. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="243">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `getHarshDrivingEvents()`

> ```java
> List<HarshDrivingEvent> getHarshDrivingEvents(String transportId)
> ```
>
> Returns the [harsh driving events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/harshdrivingevent) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="244">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `getPhoneUsageEvents()`

> ```java
> List<PhoneUsageEvent> getPhoneUsageEvents(String transportId)
> ```
>
> Returns the [phone usage events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/phoneusageevent) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="244">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `getSpeedingEvents()`

> ```java
> List<SpeedingEvent> getSpeedingEvents(@NonNull String transportId);
> ```
>
> Returns the [speeding events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/speedingevent) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="240">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `getWrongWayDrivingEvents()`

> ```java
> List<WrongWayDrivingEvent> getWrongWayDrivingEvents(String transportId);
> ```
>
> Returns the [wrong way driving events](https://docs.sentiance.com/important-topics/sdk/api-reference/android/driving-insights/speedingevent-1) for a completed, non-provisional transport. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="240">Parameters</th><th></th></tr></thead><tbody><tr><td>transportId</td><td>The ID of the desired transport.</td></tr></tbody></table>

### `setDrivingInsightsReadyListener()`

> ```java
> void setDrivingInsightsReadyListener(@Nullable DrivingInsightsReadyListener listener)
> ```
>
> Sets a listener that will be invoked when the driving insights for a completed, non-provisional transport becomes ready. See [isProvisional](https://docs.sentiance.com/important-topics/sdk/api-reference/eventtimeline/event#isprovisional) to learn more about what a provisional transport is.
>
> Note: calling this method on an uninitialized SDK will throw an [SdkException](https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkexception).

<table><thead><tr><th width="248">Parameters</th><th></th></tr></thead><tbody><tr><td>listener</td><td>A <a href="https://github.com/sentiance/v4-docs/blob/main/important-topics/sdk/api-reference/android/driving-insights/broken-reference/README.md"><code>DrivingInsightsReadyListener</code></a> to receive the driving insights. Set <code>null</code> to remove a previously set listener.</td></tr></tbody></table>
