Read workout routes
Workout routes are optional provider behavior. Check capability before showing route UI.
Request a route
Section titled “Request a route”IHealthProvider provider = HealthBridgeService.Provider;if (provider == null || !provider.Supports(HealthCapability.WorkoutRoutes)){ return;}
WorkoutRouteReadResult result = await HealthBridgeService.GetWorkoutRouteAsync(workout.Id);
if (result.RequiresUserConsent){ // Explain the route request and complete platform consent before retrying. return;}
if (!result.Success || !result.HasRoute) return;
foreach (WorkoutRoutePoint point in result.Route.Points){ // Map the point into a project-owned preview model.}Use the imported WorkoutData.Id. Android Health Connect can require explicit
route consent; iOS reads the HealthKit route associated with the workout.
Handle every outcome
Section titled “Handle every outcome”- Unsupported provider: hide or explain route UI.
- Successful result without a route: show “No route recorded.”
- Consent required: request only after explaining the feature, then retry.
- Failure: keep the workout visible and show a recoverable route error.
Render safely
Section titled “Render safely”- Do not assume constant sampling intervals.
- Handle one point, repeated coordinates, and missing altitude.
- Use
TryGetBoundswhen fitting a preview. - Keep coordinates out of screenshots, logs, analytics, and support attachments.
Routes reveal sensitive location patterns and require health-data and location privacy handling.
