submit Activities
Submits a batch of health data entries to the backend.
Each HealthData entry is normalized into a server-compatible format:
Entries with
nulldates are skipped.Duplicates (same date + activity type + device type) are deduplicated.
Zero-step entries are still submitted to record the sync timestamp.
Typically called internally by syncSteps, but exposed for custom sync flows where the consumer reads health data independently.
Kotlin
val healthData: List<HealthData> = readFromHealthConnect(dates)
val result = AFCore.smartWalking().submitActivities(healthData)
if (result.status) {
Log.d("SmartWalking", "Submitted: ${result.statusMessage}")
} else {
Log.w("SmartWalking", "Failed: ${result.statusMessage}")
}Content copied to clipboard
Swift
let result = try await AFCore.shared.smartWalking().submitActivities(activities: healthData)
if result.status {
print("Submitted: \(result.statusMessage ?? "")")
} else {
print("Failed: \(result.statusMessage ?? "")")
}Content copied to clipboard
Return
AFResult — check status for success. On failure, statusMessage describes the reason and exception may contain the underlying error.
Parameters
activities
The HealthData entries to upload. Empty list returns AFResult(status = false, "No activities to submit").