Using HealthKit, I am saving
- A Workout
- Corresponding Active Energy Samples
- Corresponding Walk/Run distance samples
I'm running the same code on the apple watch and on the iPhone.
When I'm saving on the iPhone
- I can select the workout and samples in my iPhone App
- I can see the workout and samples in the iPhone Health App
- The workout and samples are not in the iPhone activity app (bad)
When I'm saving on the apple watch
- I can select the workout and samples in my iPhone App
- I can see the workout and samples in the iPhone Health App
- I can see the workout and samples in the iPhone activity app
When I'm saving on the apple watch and delete it in my iPhone App
- I can not select the workout and samples in my iPhone App (good)
- I can not see the workout and samples in the iPhone Health App (good)
- up until watchOS 2.1 + iOS 9.2.1: I still can see the workout and samples in the iPhone activity app (very bad)
- tested with watchOS 2.2 beta 5 + iOS 9.3 beta 5: workout and samples are removed from the activity app on the iPhone (good)
When I'm saving on the apple watch and delete it in my Apple Watch App
- tested with watchOS 2.2 beta 5 + iOS 9.3 beta 5: Everything is as expected: not visible/selectable on the watch and on the iPhone with any mentioned app (good since iOS 9.3)
- up until watchOS 2.1 + iOS 9.2.1: Workout and samples were not deleted on the iPhone. (bad until iOS 9.2.1)
Question
Am I doing something wrong or is this the way HealthKit and the iPhone Activity App works?
More specific question:
- How can I save workouts and samples on the iPhone, such that the workouts and samples are not only visible in the Health App on the same iPhone, but also in the Activity App on the same iPhone?
- How can I delete workouts and samples on the iPhone, that I saved using my Watch App, such that the workouts and samples are not only deleted in the Health App on the same iPhone, but also deleted in the Activity App on the same iPhone?
If this is not my mistake, no iOS app could reliably save workouts that are shown in the activity app. The iOS app could send the data to the watch app, that is the easy part. But I know no way to process this data on the watch in background. The user has to start the watch app to process the data.
The tests were made on hardware, not on a simulator. iOS 9.2.1, watchOS 2.1
I added tests using watchOS 2.2 beta 5 + iOS 9.3 beta 5. I edited the results above. Summary: deleting is fixed, Saving on the iPhone still doesn't work.
With iOS 9.3 / watchOS 2.2, Apple added HKActivitySummary
, HKActivitySummaryQuery
and HKActivityRingView
. In short: everything said about the activity app on the iPhone also applies to HKActivitySummaryQuery. They share features and bugs described above.