Dolphin MOVE SDK
2.x
2.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
        • Access Control
        • Configuration
        • Timeline
        • Points of Interest
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
        • Troubleshooting
      • React Native
      • Flutter
      • Move SDK CLI
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Setup
        • Services
      • React Native
        • Components
        • Initialization
        • Services
      • Flutter
        • Initialization
        • Services
    • Models
      • Listeners/Callbacks
      • MoveAssistanceCallStatus
      • MoveAuth
      • MoveAuthError
      • MoveAuthResult
      • MoveAuthState
      • MoveConfig
      • MoveConfigurationError
      • MoveDevice
      • MoveDeviceStatus
      • MoveGeocodeError
      • MoveHealthItem
      • MoveHealthScore
      • MoveOptions
        • DeviceDiscovery
      • MoveSdkState
      • MoveSdkAndroidConfig
      • MoveTripState
      • MoveScanResult
      • MoveServiceFailure
      • MoveServiceWarning
      • MoveShutdownResult
    • Appendix
      • Token refresh
      • Android
        • Permission Handling
          • Permission Overview
          • Runtime Permissions
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
      • React Native
        • Permission Handling
  • MOVE Backend
    • MOVE Backend
      • MOVE Admin API
      • MOVE TIMELINE API
      • MOVE State API
      • MOVE Last Location API
    • MOVE Generic Notifier
    • MOVE Assistance Notifier
    • Example requests
  • FAQ
  • Changelog
    • Android
    • iOS
    • React
    • Flutter
    • Backend
  • Data privacy (GDPR)
Powered by GitBook
On this page
  1. MOVE SDK
  2. Models

MoveHealthScore

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?,
)
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?) {
    }
}

MoveHealthScore

reason

List<HealthReason>

A list of areas that could cause problems.

configuration

String

The current configuration as a readable text.

battery

Int

The charge value of the battery.

mobileConnection

String

The type of connection.

listeners

MoveHealthListeners

An overview of implemented listeners.

resources

MoveHealthResources

An overview about available / used memory / disk and cpu.

versions

List<MoveHealthVersion>

An overview / reminder of (new) MOVE SDK versions with important changes.

PreviousMoveHealthItemNextMoveOptions

Last updated 3 months ago