I am working on an app where HealthKit
is used and HKWorkout
sessions are created and added to the HealthKit
store.
Now after I finished an outdoor activity with Apple's native Workout app on the Watch, (like Open Water Swimming), when I then open this workout on the Activity App on my iPhone, it tells me the location where I started the activity and the weather conditions at the time.
I've been reading through the HealthKit
documentation but I could not find any API to add this information from my app to the HKWorkoutSession
.
Is it possible for developers to add this to a HKWorkout
, and if so: how?
To add weather details to your app's workouts, you must specify values for the HKMetadataKeyWeatherCondition
, HKMetadataKeyWeatherTemperature
, or HKMetadataKeyWeatherHumidity
metadata keys on the saved HKWorkout
. See the metadata keys reference for more information.
There is no API to specify a general location for the workout. However, in watchOS 4.0 your app can now save an HKWorkoutRoute
alongside an HKWorkout
to provide a map of the route the user took (documentation).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With