HealthData

class HealthData(var date: LocalDate? = null, var timeZoneId: String? = TimeZone.currentSystemDefault().id, var startZonedDateTime: String? = null, var endZonedDateTime: String? = null, var steps: Long? = null, var calories: Double? = null, var caloriesUnit: UnitTypes? = null, var distance: Double? = null, var distanceUnits: UnitTypes? = null, var duration: Long? = null, var durationUnit: UnitTypes? = null)

HealthData — represents a daily snapshot of physical activity.

Typically used with SmartWalking or health provider integrations (e.g., Apple HealthKit, Google Health Connect, Fitbit) to record steps, calories, distance, and active minutes for a specific date.

Properties

  • date Date for this data point in ISO format (yyyy-MM-dd), e.g. "2025-08-22".

  • steps Total number of steps walked.

  • calories Calories burned.

  • caloriesUnit Unit of measurement for calories (see UnitTypes).

  • distance Distance traveled.

  • distanceUnits Unit of measurement for distance (see UnitTypes).

  • duration Number of minutes of active physical movement.

  • durationUnit Unit of measurement for duration (see UnitTypes).

Notes

Android (Kotlin) — submitting steps

val today = HealthData(
date = "2025-08-22",
steps = 8743,
calories = 320.5,
distance = 6.7,
distanceUnits = DistanceUnit.KILOMETERS,
duration = 45
)

lifecycleScope.launch {
val ok = AFCore.smartwalking().submitActivities(listOf(today))
if (ok) Log.d("SmartWalking", "Submitted health data")
}

iOS (Swift) — submitting steps

let today = HealthData(
date: "2025-08-22",
steps: 8743,
calories: 320.5,
distance: 6.7,
distanceUnits: .kilometers,
duration: 45
)

Task {
do {
let ok = try await AFCore.shared.smartwalking().submitActivities([today])
if ok { print("Submitted health data") }
} catch {
print("Submit failed: \\(error.localizedDescription)")
}
}

Constructors

Link copied to clipboard
constructor(date: LocalDate? = null, timeZoneId: String? = TimeZone.currentSystemDefault().id, startZonedDateTime: String? = null, endZonedDateTime: String? = null, steps: Long? = null, calories: Double? = null, caloriesUnit: UnitTypes? = null, distance: Double? = null, distanceUnits: UnitTypes? = null, duration: Long? = null, durationUnit: UnitTypes? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var date: LocalDate?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var steps: Long?
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String