Session & Data Saving
Control session saving and data upload. Applies to: any flow ending on the results screen (Workout player and Challenge).
| Parameter | Type | Default | Applies to | What it does internally |
| shouldSendStats | boolean | false (true for AI Trainer) | Workout player, Challenge | Saves the completed session to the KinesteX backend: per-exercise stats, accuracy scores, calories and the motion recording (used for session replay). Saved sessions are available in the Workout Sessions API. For AI Trainer launches the default is true so the chat can show the completed-workout card. Send a boolean by postMessage or inside ?data= |
Messages posted to the host during saving:
workout_session_saved: the session was stored (includes the session ID and scores)motion_upload_progress: motion-recording upload progresssession_save_complete: everything (session and motion data) finished uploadingmotion_upload_error: the motion upload failed or timed out
Offline behavior: if saving fails (e.g. no connectivity), the result is queued on the device and retried when the connection returns or on the next launch. A successful retry sends workout_session_saved (and plan_progression_saved for plan workouts) only, without the motion-upload messages.
Note: independent of this flag, the results screen always posts the workout_overview / exercise_overview summaries to the host. shouldSendStats only controls backend persistence. With motionDataEnabled: false, the saved session has no replay data.
Session Saving Configuration
Swift example:
1kinestex.createWorkoutView(
2 workout: "Full Body Burn",
3 user: nil,
4 style: nil,
5 isLoading: $isLoading,
6 customParams: [
7 "shouldSendStats": true
8 ],
9 onMessageReceived: { message in /* ... */ }
10)