> For the complete documentation index, see [llms.txt](https://docs.movesdk.com/move-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/untitled.md).

# Listeners/Callbacks

## Initialize Listener

Triggers if [MoveConfigurationError](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) occurs on initialization ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/pages/-MZIfp4AHvpUSOaycA60#DolphinSdk.Builderv1.1-initializationInitializationlistener)/[iOS](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md#definition)).

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

```kotlin
interface InitializeListener {
    fun onError(error: MoveConfigurationError)
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
typealias MoveIntializationCallback = ((_ confgError: MoveConfigurationError?) -> Void)?
```

{% endtab %}
{% endtabs %}

| **Parameter**                                                                |                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [MoveConfigurationError](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) | Potiential [MoveConfigurationError](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) on initilazation ([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/pages/-MZIfp4AHvpUSOaycA60#DolphinSdk.Builderv1.1-initializationInitializationlistener)/[iOS](/move-platform/move-sdk-1.x/sdk/api-interface/ios/intialization.md#definition)). |

## SDK State Listener

Triggers whenever the [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) changes.

{% hint style="info" %}
Set an SDK State listener using`setSDKStateListener`([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/pages/-MZIfp4AHvpUSOaycA60#DolphinSdk.Builderv1.1-sdkstatelistenerSdkstatelistener)/[iOS](/move-platform/move-sdk-1.x/sdk/api-interface/ios/services.md#set-sdk-state-listener)) API to anticipate handling the SDK State changes, start detection services when [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) is `.ready` or handle`.error` if occurred.
{% endhint %}

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

```kotlin
interface StateListener {
    fun onStateChanged(sdk: MoveSdk, state: MoveSdkState)
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
typealias MoveSDKStateCallback = (_ state: MoveSDKState) -> Void
```

{% endtab %}
{% endtabs %}

| **Parameter**                                                       |                                                                             |
| ------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md) | Latest [MoveSDKState](/move-platform/move-sdk-1.x/sdk/models/movestate.md). |

## Auth State Update Listener

Triggers whenever the [MoveAuthState](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) changes.

{% hint style="warning" %}

### Authentication Expiry

The host app is expected to monitor [MoveAuthState](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md) updates via`authStateUpdateListener`([Android](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/models/pages/-MZIfp4AHvpUSOaycA60#DolphinSdk.Builderv1.1-initializationInitializationlistener-1) / [iOS](/move-platform/move-sdk-1.x/sdk/api-interface/ios/services.md#set-sdk-auth-state-listener)) API and handle those changes accordingly.

Check [Authentication updates and expiry](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md#authentication-updates-and-expiry) for more details about authentication expiry and renewal.
{% endhint %}

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

```kotlin
interface AuthStateUpdateListener {
    fun onAuthStateUpdate(state: MoveAuthState)
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
typealias MoveAuthStateCallback = (_ state: MoveAuthState) -> Void
```

{% endtab %}
{% endtabs %}

| **Parameter**                                                            |                                                                                  |
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| [MoveAuthState](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md) | Latest [MoveAuthState](/move-platform/move-sdk-1.x/sdk/models/moveauthstate.md). |

## Trip State Listener

Triggers whenever the [MoveTripState](/move-platform/move-sdk-1.x/sdk/models/movetripstate.md) changes.

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

```kotlin
interface TripStateListener {
    fun onTripStateChanged(sdk: MoveSdk, tripState: MoveTripState)
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
typealias MoveTripStateCallback = (_ tripState: MoveTripState) -> Void
```

{% endtab %}
{% endtabs %}

| **Parameter**                                                            |                                                                                  |
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| [MoveTripState](/move-platform/move-sdk-1.x/sdk/models/movetripstate.md) | Latest [MoveTripState](/move-platform/move-sdk-1.x/sdk/models/movetripstate.md). |

## Trip Metadata Provider

Triggers whenever a trip is ending, for the host app to append metadata along with that trip if needed.

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

```kotlin
interface TripMetadataProvider {
    fun provideMetadata(start: Long, end: Long): Map<String, String>
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
typealias MoveMetaDataCallback = (_ tripStart: Date, _ tripEnd: Date) -> [String: String]
```

{% endtab %}
{% endtabs %}

| **Parameter**   |           |                            |
| --------------- | --------- | -------------------------- |
| start/tripStart | Long/Date | Trip start timestamp/date. |
| end/tripEnd     | Long/Date | Trip end timestamp/date.   |

| **Return**                                  |
| ------------------------------------------- |
| A String dictionary of the trip's metadata. |

## Device Status Callback

Triggers whenever [MoveDeviceStatus](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md) changes.

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

```swift
typealias MoveDeviceStatusCallback = (_ status: MoveDeviceStatus) -> Void
```

{% endtab %}
{% endtabs %}

| **Parameter**                                                                  |                                                                                        |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| [MoveDeviceStatus](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md) | Latest [MoveDeviceStatus](/move-platform/move-sdk-1.x/sdk/models/movedevicestatus.md). |

## Log Callback

Triggers whenever a new log event occurs.

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

```swift
typealias MoveLogCallback = (_ log: String) -> Void
```

{% endtab %}
{% endtabs %}

| **Parameter** |        |                |
| ------------- | ------ | -------------- |
| log           | String | New log event. |
