Post

Replies

Boosts

Views

Activity

Workout data: should my app be a producer or a listener?
Hello, I’m currently building a hiking app for iPhone and I’d like it to track the user’s hikes with HKWorkout. I’ve learned how to create workouts with HKWorkoutBuilder, and also how to attach a route with HKWorkoutRouteBuilder. But I’m wondering how I should get data such as distance, steps, etc. My question is: should my app generate this data? And what is the recommended way to do so? Or, should I observe HealthKit with a query? I understand that in any case I have to add the data to the HKWorkout. Also, and this is a more general HealthKit question. How does HealthKit resolves conflicts between data points in the same time period? What if for example, my app saves a swimming workout of 10 minutes, whearas the user was actually doing a walk? And also, what if my app says the user has walked 1000 steps the past hour wheras in reality he’s done only 500? And another related question, how does the system choose which device to listen to? If you’ve got an Apple Watch and an iPhone while walking, which measures will be prioritized? I’m asking this because I’ve noticed in HealthKit that I had steps samples from both my iPhone and my Apple Watch at the same time, with different values… Edit: WWDC session 20-10664 answer this question at 17:19. I know that’s a lot of questions. Thank you in advance for your time. 🙂
0
0
526
Jul ’20