# MoveHealthScore

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

```kotlin
data class MoveHealthScore(
    val reason: List<HealthReason>,
    val configuration: String,
    val battery: Int,
    val mobileConnection: String,
    val listeners: MoveHealthListeners,
    val resources: MoveHealthResources,
    val versions: List<MoveHealthVersion>?,
)

enum class HealthReason {
    CPU_USAGE,
    DISK_USAGE,
    BATTERY_LEVEL,
    INTERNET_USAGE,
    MEMORY_USAGE,
    NEW_VERSION,
    UNIMPLEMENTED_LISTENERS;
}

data class MoveHealthListeners(
    val auth: Boolean,
    val state: Boolean,
    val trip: Boolean,
    val failure: Boolean,
    val warning: Boolean,
)

data class MoveHealthResources(
    val cpu: Int,
    val memory: MoveHealthResourcesMemory,
    val disk: MoveHealthResourcesDisk,
)

data class MoveHealthResourcesMemory(
    val totalBytes: Long,
    val freeBytes: Long,
    val usedBytes: Long,
)

data class MoveHealthResourcesDisk(
    val totalBytes: Long,
    val freeBytes: Long,
    val usedBytes: Long,
)

data class MoveHealthVersion(
    val version: String?,
    val warning: String?,
    val message: String?,
)

```

{% endtab %}

{% tab title="Flutter" %}

```dart
enum MoveHealthReason {
  batteryLevel,
  cpuUsage,
  diskUsage,
  internetUsage,
  memoryUsage,
  newVersion,
  unimplementedListeners
}

MoveHealthReason? mapHealthReason(String kotlinEnum) {
  final mapping = {
    "BATTERY_LEVEL": MoveHealthReason.batteryLevel,
    "CPU_USAGE": MoveHealthReason.cpuUsage,
    "DISK_USAGE": MoveHealthReason.diskUsage,
    "INTERNET_USAGE": MoveHealthReason.internetUsage,
    "MEMORY_USAGE": MoveHealthReason.memoryUsage,
    "NEW_VERSION": MoveHealthReason.newVersion,
    "UNIMPLEMENTED_LISTENERS": MoveHealthReason.unimplementedListeners,
  };

  return mapping[kotlinEnum];
}


// Within MoveSdkPlugin.kt
class HealthListenerStreamHandler() : EventChannel.StreamHandler {
    private val uiThreadHandler: Handler = Handler(Looper.getMainLooper())

    override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
        MoveSdk.get()?.setMoveHealthScoreListener(
            object : MoveSdk.MoveHealthScoreListener {
                override fun onMoveHealthScoreChanged(result: MoveHealthScore) {
                    val reasonName: String = result.reason.firstOrNull()?.name ?: ""
                    var description = "Battery: ${result.battery}, Mobile Conn.: ${result.mobileConnection}"
                    uiThreadHandler.post {
                        events?.success(
                            listOf(
                                mapOf(
                                    "reason" to reasonName,
                                    "description" to description,
                                )
                            )
                        )
                    }
                }
            }
        )
    }

    /// Cancel listening for health listener changes.
    override fun onCancel(arguments: Any?) {
    }
}
```

{% endtab %}
{% endtabs %}

<table data-header-hidden><thead><tr><th width="217.5"></th><th width="223"></th><th></th></tr></thead><tbody><tr><td><strong>MoveHealthScore</strong></td><td></td><td></td></tr><tr><td>reason</td><td>List&#x3C;HealthReason></td><td>A list of areas that could cause problems.</td></tr><tr><td>configuration</td><td>String</td><td>The current configuration as a readable text.</td></tr><tr><td>battery</td><td>Int</td><td>The charge value of the battery.</td></tr><tr><td>mobileConnection</td><td>String</td><td>The type of connection.</td></tr><tr><td>listeners</td><td>MoveHealthListeners</td><td>An overview of implemented listeners.</td></tr><tr><td>resources</td><td>MoveHealthResources</td><td>An overview about available / used memory / disk and cpu.</td></tr><tr><td>versions</td><td>List&#x3C;MoveHealthVersion></td><td>An overview / reminder of (new) MOVE SDK versions with important changes.</td></tr></tbody></table>


---

# 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/models/movehealthscore.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.
