Skip to content

Read workout routes

Workout routes are optional provider behavior. Check capability before showing route UI.

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.

  • 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.
  • Do not assume constant sampling intervals.
  • Handle one point, repeated coordinates, and missing altitude.
  • Use TryGetBounds when 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.