Fit@Home
Fit@Home lets a member earn credit for an at-home workout by submitting a selfie. Your app shows the camera and captures the image as a JPEG (or PNG); the SDK uploads it for review, and the workout appears in the member's activity history.
What you can do
- Submit a selfie for today's workout, with an optional location.
- Delete a pending selfie so the member can retake it.
- Keep the one-selfie-per-day rule: a day holds one selfie whatever its status. Only a pending selfie can be deleted and retaken.
If the device has no connection when the member submits, the SDK keeps the selfie and uploads it automatically once the connection returns; the result tells you so, and you do not retry it yourself. A selfie that is empty or not a JPEG or PNG fails right away, online or offline, with a message you can show.
Key APIs
| Call | What it is for |
|---|---|
fitAtHome().submitSelfie(...) | Submit the workout selfie |
fitAtHome().deleteSelfie(date) | Delete the selfie for a day |
AFPermissions.requestPermission(Permission.CAMERA) | Ask for the camera before capturing |
Example
- Android (Kotlin)
- iOS (Swift)
lifecycleScope.launch {
val result = AFCore.fitAtHome().submitSelfie(
media = selfieBytes, // the captured JPEG
timestampInSeconds = Clock.System.now().epochSeconds,
lat = null,
lng = null
)
when {
result.queued -> showMessage("No connection - your workout will upload automatically")
result.status -> showSuccess("Workout submitted")
else -> showError(result.statusMessage)
}
}
// `media` is the captured JPEG as a KotlinByteArray
let result = try await AFCore.shared.fitAtHome().submitSelfie(
media: media,
timestampInSeconds: Int64(Date().timeIntervalSince1970),
lat: nil,
lng: nil
)
if result.queued {
showMessage("No connection - your workout will upload automatically")
} else if result.status {
showSuccess("Workout submitted")
} else {
showError(result.statusMessage)
}
UI Reference
Present a camera viewfinder with a face guide and a capture button, then a preview so the member can retake before uploading.
Learn more
- API Reference for
fitAtHome(). - Complete integration guides, including camera capture, are in AIDE Docs.