submit

abstract suspend fun submit(payload: Map<String, String>): AFResult

Submits a diagnostic payload.

The payload is a free-form map of string keys to string values describing the current device or app environment. There are no reserved keys — you choose the key names — and the SDK forwards the map to the backend as-is. Typical entries report on-device capabilities and permission/connectivity status, for example: connectivity flags ("wifi", "bluetooth", "cellular"), permission states ("location", "notifications", "healthConnect"), or app/SDK metadata ("appVersion", "osVersion"). Values are arbitrary strings; booleans should be encoded as "true" / "false".

If the device is offline the submission is queued and delivered later through the SDK's offline outbox; in that case the returned AFResult reports queued == true.

Return

AFResult indicating success or failure. queued == true when the submission was deferred to the offline outbox.

Parameters

payload

A Map of string key-value pairs to submit. Keys are caller-defined (no reserved names); for example, {"wifi": "true", "bluetooth": "true"}.

Throws

if the request fails.

Android (Kotlin)

lifecycleScope.launch {
try {
val payload = mapOf("wifi" to "true", "bluetooth" to "true")
val result = AFCore.diagnostics().submit(payload)
if (result.status) {
showMessage("Diagnostics submitted successfully")
} else {
showError("Diagnostics submission failed")
}
} catch (t: Throwable) {
showError("Failed to submit diagnostics: ${t.message}")
}
}

iOS (Swift)

Task {
do {
let payload = ["wifi": "true", "bluetooth": "true"]
let result = try await AFCore.shared.diagnostics().submit(payload: payload)
if result.status {
self.showMessage("Diagnostics submitted successfully")
} else {
self.showError("Diagnostics submission failed")
}
} catch {
self.showError("Failed to submit diagnostics: \(error.localizedDescription)")
}
}