# Services

## **Configuration services**

### Update Config <a href="#update-authentication" id="update-authentication"></a>

Change the config originally passed in setup.

```kotlin
fun updateConfig(config: MoveConfig, options: MoveOptions? = null)
```

| **Parameters** |                                                         |                                                  |
| -------------- | ------------------------------------------------------- | ------------------------------------------------ |
| config         | [MoveConfig](/move-platform/sdk/models/moveconfig.md)   | Move services configuration.                     |
| options        | [MoveOptions](/move-platform/sdk/models/moveoptions.md) | Optional MoveOptions if they need to be changed. |

Occasionally this functionality is needed for deployed apps when a projects configuration is updated on the backend.

### Update authentication <a href="#update-authentication" id="update-authentication"></a>

{% hint style="warning" %}
**Deprecated:** Token expiry is no longer a valid auth state forwarded to the app and does not need to be handled.
{% endhint %}

Updates MOVE SDK [MoveAuth](/move-platform/sdk/models/moveauth.md#android). The host app was expected to fetch a new [MoveAuth](/move-platform/sdk/models/moveauth.md) using its project API key and pass it to the MoveSDK using the following API:

```kotlin
@Deprecated("Do not use manual token update, this will be handled internally by the Move SDK")
fun updateAuth(auth: MoveSdk.Auth, onError: (MoveAuthError) -> Unit)
```

### Get MOVE SDK Config

{% hint style="info" %}
Since MOVE SDK v2.16
{% endhint %}

Returns the active [MoveConfig](/move-platform/sdk/models/moveconfig.md#android) based on the current configuration source.

If `useBackendConfig` is enabled, the MOVE Dashboard configuration is returned. Otherwise, the local client configuration is returned.

```kotlin
fun getMoveConfig(): MoveConfig
```

### **Set Remote Config Change Listener**&#x20;

{% hint style="info" %}
Since MOVE SDK v2.5
{% endhint %}

Provides a block to be invoked every time [MoveConfig](/move-platform/sdk/models/moveconfig.md) was successfully fetched from the server.

If the MoveConfig object couldn't be fetched from the server then a [MoveConfigurationError](/move-platform/sdk/models/moveconfigurationerror.md) ServiceUnreachable will be triggered.

{% hint style="warning" %}
This listener is only triggered if `useBackendConfig` is enabled.
{% endhint %}

```kotlin
fun setRemoteConfigChangeListener(listener: RemoteConfigChangeListener)
```

| **Parameters** |                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------------------- |
| listener       | A callback returning a [MoveConfig](/move-platform/sdk/models/moveconfig.md) object after a successful server fetch. |

## Detection Services

### Start Automatic Detection

Starts the required detection services stated in the [MoveConfig](/move-platform/sdk/models/moveconfig.md) passed on initialization. Starting the service will set the [MoveSdkState](/move-platform/sdk/models/movestate.md) to `Running`.

{% hint style="warning" %}
**Precondition**: MOVE SDK must be in`READY`[MoveSdkState](/move-platform/sdk/models/movestate.md).
{% endhint %}

```kotlin
fun startAutomaticDetection()
```

### **Stop Automatic Detection**

Stops the automatic detection service, including all MOVE SDK services like driving detection, points of interest, walking and places. Stopping the service will set the [MoveSdkState](/move-platform/sdk/models/movestate.md) back to `Ready`.&#x20;

{% hint style="warning" %}
**Precondition**: MOVE SDK must be in`Running`[MoveSdkState](/move-platform/sdk/models/movestate.md).
{% endhint %}

```kotlin
fun stopAutomaticDetection()
```

## Trip Services

### **Force Trip Recognition**

Temporarily calibrates the MOVE SDK to the highest detection mode.

In order to optimize battery consumption, the MOVE SDK goes through different detection modes with different battery consumption levels, depending on the user's current behavior and activity. In general, the MOVE SDK is responsible for alternating between those different detection modes.&#x20;

The MOVE SDK also provides hosting apps this API to call if they have their own reasons (like buttons, sensors or beacons) to believe that the user is starting a trip. This will make sure the MOVE SDK is on the highest detection state to detect the trip faster.

{% hint style="warning" %}
&#x20;**Precondition**: SDK must be in`RUNNING` [MoveSdkState](/move-platform/sdk/models/movestate.md).
{% endhint %}

<pre class="language-kotlin"><code class="lang-kotlin"><strong>fun forceTripRecognition()
</strong>fun forceTripRecognition(duration: Long) 
</code></pre>

| **Parameters** | **Type** |                                                                                                                                     |
| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| duration       | Long     | Limit the high power detection to a certain amount of time in milliseconds, to not drain the battery. Default one minute (60 000ms) |

### **Manual Start Trip**

Manually force the start of a trip, bypassing trip validation checks. This non-standard SDK usage may be feasible only in situations where active user input can be expected. Using the metadata parameter, self-defined information can be added to each trip which can be fetched from the [timeline](/move-platform/backend/move-backend/move-timeline-api.md#trip-metadata).

```kotlin
fun startTrip(metadata: Map<String, String>?)
```

{% hint style="danger" %}
Be sure that you set the **`start`** flag  to **`false`** during the MOVE SDK setup.

e.g.:\
\
`setup(`\
&#x20;      `auth = moveAuth,`\
&#x20;      `config = moveConfig,`\
&#x20;     **`start = false`**\
`)`
{% endhint %}

{% hint style="warning" %}
**Precondition**: MOVE SDK must be in`.ready`[MoveSdkState](/move-platform/sdk/models/movestate.md).

Manually starting a trip bypasses additional trip detection checks. It is strongly recommended to finish manually started trips with `finishCurrentTrip()`
{% endhint %}

{% hint style="warning" %}
Starting a trip with *startTrip(...)* prevents the execution of *startAutomaticDetection()*.
{% endhint %}

### **Finish Current Trip**

Ends the current ongoing trip.

This API will end the ongoing trip and set [MoveTripState](/move-platform/sdk/models/movetripstate.md) back to `.idle`. The MOVE SDK is responsible for detecting the trip start and end points. The MOVE SDK also provides hosting apps this API to call if they have their own reasons (like sensors or beacons) to believe that the user's trip has ended.

{% hint style="warning" %}
**Precondition**:[ MoveTripState](/move-platform/sdk/models/movetripstate.md) should be in an active trip.
{% endhint %}

```kotlin
fun finishCurrentTrip()
```

{% hint style="info" %}
If this API is called while the user is active on a driving trip, a new trip will start again right away. If the intention is to un-track the ongoing trip, call `ignoreCurrentTrip`API.

More information about trip states can be found in [MoveTripState](/move-platform/sdk/models/movetripstate.md).
{% endhint %}

{% hint style="info" %}
If the trip was started with [`startTrip(metadata:)`](#manual-start-trip)`finishCurrentTrip()` brings the SDK back to `.ready` state.
{% endhint %}

### **Ignore Current Trip**

Ignores the current ongoing trip.&#x20;

This API will set the ongoing [MoveTripState](/move-platform/sdk/models/movetripstate.md) to `.ignored`. Data of ignored trips is purged and not sent to the server.

{% hint style="warning" %}
**Precondition**: [MoveTripState](/move-platform/sdk/models/movetripstate.md) should be in an active trip.
{% endhint %}

```kotlin
fun ignoreCurrentTrip()
```

### **Set Trip Start Listener**&#x20;

Provides a block to be invoked when a trip actually begins.

In comparison to the tripStateListener (only state changes) the tripStartListener will provide you with the start time of the actual trip.

```kotlin
fun setTripStartListener(listener: TripStartListener)
```

## Processing Services

### **Keep in foreground**

When an Android application is in the background it may receive limited data (location, sensors, etc.). To improve this behavior, it is possible to put the application always in the foreground with a visible notification that cannot be discarded. Just because it's visible it doesn't mean that it is performing any data collection at all. So this should not have any significant battery impact at all.

{% hint style="info" %}
Disabled by default.
{% endhint %}

{% hint style="warning" %}
Since it may be annoying to the user, it should only be enabled in case of problems.
{% endhint %}

```kotlin
fun keepInForeground(enabled: Boolean)
```

### **Keep active**

To save battery consumption, the MOVE SDK is using several triggers to start its data listeners. In case of trouble, these triggers can be circumvented by allowing the MOVE SDK to stay active all the time. In that case the MOVE SDK is always monitoring required data and is therefore consuming more battery. Depending on the configuration, it may happen that the notification (see[ notification handling](/move-platform/sdk/appendix/android/notification-managment.md)) is always visible to the user.

{% hint style="info" %}
Disabled by default.
{% endhint %}

{% hint style="warning" %}
Since this is consuming more battery, it should only be enabled in case of problems.
{% endhint %}

```kotlin
fun keepActive(enabled: Boolean)
```

### **Console logging**

Toggles whether the MOVE SDK is allowed to log into the console or not.&#x20;

{% hint style="info" %}
Enabled by default.
{% endhint %}

```kotlin
fun consoleLogging(enabled: Boolean)
```

| **Parameters** |                                                               |
| -------------- | ------------------------------------------------------------- |
| enabled        | Boolean that sets MOVE SDK console logging to enabled or not. |

### Mock locations <a href="#dolphinsdk.builderv1.1-allowmockmocklocations" id="dolphinsdk.builderv1.1-allowmockmocklocations"></a>

In Android it is possible to use simulated location by enabling it in the device developer mode.\
If you want the MOVE SDK to support those locations, you need to specify it. By default this is disabled to prevent wrong data.&#x20;

{% hint style="warning" %}
Points of Interests are not supported with mock locations.\
Keep in mind that mock locations may have negative impact on trip recognition afterwards.
{% endhint %}

{% hint style="info" %}
Rooted devices are still able to send mock locations without allowing mock locations.
{% endhint %}

```kotlin
.allowMockLocations(allow: Boolean)
```

| **Parameters** |                                                                              |
| -------------- | ---------------------------------------------------------------------------- |
| allow          | Allows driving with mock locations. Should only be used in debug/test builds |

### **Get MOVE SDK State**

Gets the current[ MoveSdkState](/move-platform/sdk/models/movestate.md).

```kotlin
fun getSDKState() : MoveSDKState
```

| **Return**                                             |                                                                |
| ------------------------------------------------------ | -------------------------------------------------------------- |
| [MoveSdkState](/move-platform/sdk/models/movestate.md) | Latest [MoveSdkState](/move-platform/sdk/models/movestate.md). |

### **Get Trip State**

Gets the current [MoveTripState](/move-platform/sdk/models/movetripstate.md).

```kotlin
fun getTripState(): MoveTripState
```

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

### Get Device Status

Gets the current [MoveDeviceStatus](/move-platform/sdk/models/movedevicestatus.md)*.*

```kotlin
fun getDeviceStatus(): MoveDeviceStatus
```

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

### Get Service Failures

Gets the current [MoveServiceFailures](/move-platform/sdk/models/moveservicefailure.md#android).

```kotlin
func getServiceErrors(): List<MoveServiceFailure>
```

| **Return**                                                                            |                            |
| ------------------------------------------------------------------------------------- | -------------------------- |
| List of [MoveServiceFailure](/move-platform/sdk/models/moveservicefailure.md#android) | A list of failed services. |

### Set Service Error Listener

```kotlin
func setServiceErrorListener(listener: MoveErrorListener)
```

Provide a block to be invoked every time [MoveServiceFailures ](/move-platform/sdk/models/moveservicefailure.md#android)will change.

| **Parameters**                                                                                 |                                                             |
| ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| [MoveErrorListener](/move-platform/sdk/models/listeners-callbacks.md#service-failure-callback) | Block that gets invoked when service failure state changes. |

### Get Service Warnings

Gets the current [MoveServiceWarnings](/move-platform/sdk/models/moveservicefailure.md).

```kotlin
func getServiceWarnings(): List<MoveServiceWarning>
```

| **Return**                                                                             |                                       |
| -------------------------------------------------------------------------------------- | ------------------------------------- |
| List of [MoveServiceWarnings](/move-platform/sdk/models/moveservicewarning.md#android) | A list of partially working services. |

### Set Service Warning Listener

Provide a block to be invoked every time [MoveServiceWarnings ](/move-platform/sdk/models/moveservicewarning.md#android)will change.

```kotlin
fun setServiceWarningListener(listener: MoveWarningListener)
```

<table data-header-hidden><thead><tr><th width="256">Listener</th><th></th></tr></thead><tbody><tr><td><strong>Listener</strong></td><td></td></tr><tr><td><a href="/pages/-McyOiBhGHk7b4Lw-4oa#service-warning-callback">MoveWarningListener</a></td><td>Block that gets invoked when service warnings change.</td></tr></tbody></table>

### **Shutdown SDK**

Shutdown SDK shared instance.

Stops SDK services, send the queued user data, and de-initializes the MOVE SDK. After .shutdown() is executed, the [MoveSdkState](/move-platform/sdk/models/movestate.md) will transit to `Uninitialised`.

{% hint style="warning" %}
**Precondition:** MOVE SDK must be initialized.
{% endhint %}

```kotlin
fun shutdown(force: Boolean = true, callback: ((MoveShutdownResult) -> Unit)? = null)
```

<table data-header-hidden><thead><tr><th width="192.33333333333331"></th><th width="148"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td><strong>Default</strong></td><td></td></tr><tr><td>force</td><td>true</td><td>If true, <em>shutdown</em> executes immediately. Pending Data may be lost.</td></tr><tr><td>callback</td><td>null</td><td>Returns a <a href="/pages/8oQEwj2v8SSKn1ib9gng#android">MoveShutdownResult</a> upon completion. May fail if not forced.</td></tr></tbody></table>

### Set Health Score Listener

Provide a block to be invoked every time MoveHealthScore[ ](/move-platform/sdk/models/moveservicewarning.md#android)will change.

```kotlin
fun setMoveHealthScoreListener(listener MoveHealthScoreListener)
```

<table data-header-hidden><thead><tr><th width="260.3333333333333"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td><a href="/pages/-McyOiBhGHk7b4Lw-4oa#sdk-health-listener">MoveHealthScoreListener</a></td><td>Block that get's invoked when the health score changes.</td></tr></tbody></table>

### Geocoding

Geo-coordinate address lookup.

```kotlin
fun geocode(latitude: Double, longitude: Double, result: (GeocodeResult) -> Unit)
```

<table data-header-hidden><thead><tr><th width="177"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td>latitude</td><td>Geo-coordinate latitude</td></tr><tr><td>longitude</td><td>Geo-coordinate longitude</td></tr><tr><td>completion</td><td>Callback that returns a <em>Result</em> with an address S<em>tring</em> or a <a href="/pages/Wj4MyiWNuZprGeMEmXPA#android">MoveGeocodeError</a></td></tr></tbody></table>

Geocode will try a *reverseGeocodeLocation* or fallback to contacting the MOVE backend to attempt a geo-lookup.

{% hint style="warning" %}
**Throttle:** *Geocode* is limited to a maximum of 100 lookups per hour.
{% endhint %}

### **Delete Local Data**

Deletes all the collected user MOVE SDK data stored on the device. This doesn't affect the [MoveSDKState](/move-platform/sdk/models/movestate.md).

{% hint style="warning" %}
**Precondition:** [MoveSDKState](/move-platform/sdk/models/movestate.md) should be initialized.
{% endhint %}

```kotlin
fun deleteLocalData()
```

### **Synchronize User Data**

Used to force synchronizing user data with the MOVE backend. Limited to once per 2 minutes.

```kotlin
fun synchronizeUserData(result: ((Boolean) -> Unit)?)
```

The result Returns FALSE in case there are Timeline-relevant packages in the queue that remain to be sent to the MOVE backend; and it returns TRUE in case the queue is empty.

<table data-header-hidden><thead><tr><th width="247"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td>result</td><td>Optional callback to retrieve result</td></tr></tbody></table>

## Other services

### Live Location TAG

{% hint style="info" %}
Deprecated in MOVE SDK 2.17.0
{% endhint %}

{% hint style="info" %}
New feature since MOVE SDK 2.8.0
{% endhint %}

Adds a Tag (=string value) to trip events. This Tag information is added to the timeline data.

To clear the Tag pass `null` as parameter.

After a `shutdown(...)` ([Android](/move-platform/sdk/api-interface/android/services.md#shutdown-sdk) / [iOS](#shutdown-sdk)) the Tag is also cleared.

```kotlin
@Deprecated("Please get in touch with the MOVE SDK team if you want to use this method.")
fun setLiveLocationTag(tag: String?): Boolean
```

<table data-header-hidden><thead><tr><th width="158"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td>tag</td><td>String <code>[a-z] [0-9]</code> and <code>null</code> to clear the Tag.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="160"></th><th></th></tr></thead><tbody><tr><td><strong>Return values</strong></td><td></td></tr><tr><td>true</td><td>Live Location Tag is applied.</td></tr><tr><td>true</td><td>Live Location Tag is cleared. (parameter <code>null</code>)</td></tr><tr><td>false</td><td>Live Location Tag exceeds the limit of 200 characters.</td></tr><tr><td>false</td><td>Live Location Tag is blank or empty.</td></tr><tr><td>false</td><td>If the passed chars are not one of these [a-z] [0-9].</td></tr></tbody></table>

### Initiate Assistance Call

{% hint style="info" %}
New feature in MOVE SDK 2.x; configuration in MOVE dashboard pending - please [get in touch](mailto:info@dolph.in?subject=MOVE%20SDK).
{% endhint %}

Initiate an assistance call to emergency services.

{% hint style="warning" %}
**Precondition:** The assistance call service needs to be configured. The MOVE SDK needs to be in *ready* or *running* state.
{% endhint %}

```kotlin
fun initiateAssistanceCall(assistanceListener: AssistanceStateListener)
```

| **Parameters**     |                                                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------------------------------- |
| assistanceListener | A callback returning a [MoveAssistanceCallStatus](/move-platform/sdk/models/moveassistancecallstatus.md#android). |

### Set Assistance MetaData

{% hint style="info" %}
New feature since MOVE SDK 2.1.
{% endhint %}

```kotlin
fun setAssistanceMetaData(assistanceMetadataValue: String?)
```

{% hint style="info" %}
**Before** SDK 2.4 Android returns null.
{% endhint %}

Get a unique qualifier to identify the individual device.

<table data-header-hidden><thead><tr><th width="283"></th><th width="174"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td><td></td></tr><tr><td>assistanceMetadataValue</td><td>String</td><td>A string to be sent with each assistance call or impact.</td></tr></tbody></table>

The metadata string is set once, and then sent to the server with each and every manual assistance call and with AID report. The contents of the string can be anything, e.g. JSON data. The assistance data is persisted once set.

### Get Device Qualifier

Get a unique qualifier to identify the individual device. For Android returns null&#x20;

```kotlin
fun getDeviceQualifier(): String?
```

The device qualifier should be passed to the backend during user registration. See [Move backend](/move-platform/backend/move-backend/move-admin-api.md#gettingstartedwiththedolphinmovetimelineservice-authentication).

## Device Discovery

{% hint style="danger" %}
Due to limitations in Android’s Classic Bluetooth APIs, reliable connection status tracking may not always be possible. For more details and available workarounds, see [Forcing the Signal - Classic Bluetooth](/move-platform/sdk/appendix/android/forcing-the-signal-classic-bluetooth.md).
{% endhint %}

Device discovery for Bluetooth devices. Multiple devices can be registered.

The configuration of the scanning will be done with the object `DeviceDiscovery` in MoveOptions during MOVE SDK setup. From the start of a trip registered devices are scanned after a `startDelay` and are scanned for `duration`. This scan will repeat after an `interval`.

To scan for Bluetooth devices only once then the flag `stopScanOnFirstDiscovered` should be set.

Device scanning results are appended to the trip [metadata](https://docs.movesdk.com/move-platform/sdk/api-interface/android/pages/-MZIfp4AHvpUSOaycA60#dolphinsdk.builderv1.2-metadatametadata-1).

Registering/unregistering devices during a trip may result in undefined behavior.

{% hint style="warning" %}
Before the DeviceDiscovery configuration can be changed, a [shutdown](#shutdown-sdk) with a following [setup](/move-platform/sdk/api-interface/android/initialization.md#setup) must be executed.
{% endhint %}

### Set Device Discovery Listener

Set a device discovery listener to be fired when registered [MoveDevice](/move-platform/sdk/models/movedevice.md#android)'s are scanned.

{% hint style="warning" %}
If [stopScanOnFirstDiscovered](/move-platform/sdk/models/moveoptions/devicediscovery.md#android) of the [DeviceDiscovery](/move-platform/sdk/models/moveoptions/devicediscovery.md) object is set to true then the list of MoveScanResults may be incomplete.
{% endhint %}

```kotlin
fun deviceDiscoveryListener(listener: DeviceDiscoveryListener)
```

| **Parameters**                                                                                                    |                                                                                       |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| listener -> [DeviceDiscoveryListener](/move-platform/sdk/models/listeners-callbacks.md#device-discovery-listener) | A callback returning a [MoveScanResult](/move-platform/sdk/models/movescanresult.md). |

### Set MoveDevice Connection State Listener

{% hint style="info" %}
Since MOVE SDK v2.10.0
{% endhint %}

Set a [MoveDevice](/move-platform/sdk/models/movedevice.md) connection state listener to be fired when the Bluetooth connection state of a previously registered [MoveDevice](/move-platform/sdk/models/movedevice.md#android) has changed.

```kotlin
fun setDeviceStateListener(listener: MoveDeviceStateListener?)
```

| **Parameters**                                                                                                           |                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| listener -> [MoveDeviceStateListener](/move-platform/sdk/models/listeners-callbacks.md#movedevice-state-change-listener) | A callback returning the [MoveDevice](/move-platform/sdk/models/movedevice.md) which connection state was changed. |

### Register Device

{% hint style="warning" %}
Please note that MoveDevices can only be registered if the SDK has been configured with .setup()
{% endhint %}

Register [MoveDevice](/move-platform/sdk/models/movedevice.md#android)'s / add more [MoveDevice](/move-platform/sdk/models/movedevice.md#android)'s:

```kotlin
fun registerDevices(devices: List<MoveDevice>): Boolean
```

<table data-header-hidden><thead><tr><th width="239.90234375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td>devices</td><td>A list of <a href="/pages/dzjjyMr06J88m2uWGYMk#android">MoveDevice</a>'s to be scanned during a trip.</td></tr></tbody></table>

### Unregister Device

Unregister a [MoveDevice](/move-platform/sdk/models/movedevice.md#android):

```kotlin
fun unregisterDevices(devices: List<MoveDevice>): Boolean
```

All devices are unregistered after [shutdown](/move-platform/sdk/api-interface/ios/setup.md#shutdown).

<table data-header-hidden><thead><tr><th width="240.12890625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameters</strong></td><td></td></tr><tr><td>devices</td><td>A list of <a href="/pages/dzjjyMr06J88m2uWGYMk#android">MoveDevice</a>'s that should no longer be scanned during a trip.</td></tr><tr><td><strong>Return</strong></td><td></td></tr><tr><td>Boolean</td><td><p>true: </p><ul><li>If the registration of the MoveDevice on the backend was successful.</li></ul><p>false:</p><ul><li>If the MOVE SDK is not initialised.</li><li>If there is an error during the MoveDevice registration process. See MoveDeviceStateListener</li></ul></td></tr><tr><td><strong>Throws</strong></td><td></td></tr><tr><td>IllegalArgumentException</td><td><ul><li>If the beacon device Id is not a valid UUID.</li><li>If the length of device display name is longer than 1000 characters.</li></ul></td></tr></tbody></table>

### Get Registered Devices

Get current registered [MoveDevice](/move-platform/sdk/models/movedevice.md#android)'s.

```kotlin
suspend fun getRegisteredDevices(): List<MoveDevice>
```

Alternative it is possible to subscribe to registered devices changes.

```kotlin
fun getRegisteredDevicesFlow(): Flow<List<MoveDevice>>
```

### Additional device discovery methods

```kotlin
fun convertToMoveDevice(scanResult: ScanResult): MoveDevice
```

Converts [android.bluetooth.le.ScanResult](https://developer.android.com/reference/kotlin/android/bluetooth/le/ScanResult#) into a MOVE SDK specific [MoveDevice](/move-platform/sdk/models/movedevice.md).

```kotlin
fun convertToMoveDevice(bluetoothDevice: BluetoothDevice): MoveDevice
```

Converts [android.bluetooth.BluetoothDevice](https://developer.android.com/reference/android/bluetooth/BluetoothDevice) into a MOVE SDK specific [MoveDevice](/move-platform/sdk/models/movedevice.md).

## Step Counter (via Google Health Connect)

{% hint style="info" %}
Since MOVE SDK v2.14
{% endhint %}

Only available if this feature is enabled in the backend ([MOVE SDK Dashboard](https://dashboard.movesdk.com/admin/sdkConfig)) and the user grants the permission `android.permission.health.READ_STEPS` . To collect steps even the app is in background, the permission`android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND`  is required.

For more information regarding Health Connect please see [Android - Health Connect](https://developer.android.com/health-and-fitness/guides/health-connect/develop/get-started).

{% hint style="warning" %}
Please note that Health Connect requires an additional fitness app. These apps must be synced with Health Connect. Check the manual of the fitness app to see how to connect it to Health Connect.
{% endhint %}

Add the following permissions to your AndroidManifest.xml file :

```xml
<!--Permissions for the step counter feature (Health)-->
<uses-permission android:name="android.permission.health.READ_STEPS"/>
<uses-permission android:name="android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND" />
```

Also you need to intent filter for  Health Connect permission handling:

```xml
<!--To use Health feature your app must handle health permissions-->
<intent-filter>
    <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE"/>
    <category android:name="android.intent.category.HEALTH_PERMISSIONS"/>
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
    <category android:name="android.intent.category.HEALTH_PERMISSIONS" />
</intent-filter>
```

See also [MoveServiceFailure](/move-platform/sdk/models/moveservicefailure.md) for permissions and Health Connect related errors.


---

# 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://docs.movesdk.com/move-platform/sdk/api-interface/android/services.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.
