Group Group Group Group Group Group Group Group Group

Best approach to actively monitor speed and distance for bicycling

I was going to go with CMPedometer to track the speed and distance values. But how accurate will the readings be when the user transitions from walking to jogging to bicycling? Another way I was looking into was using HealthKit. If my understanding is correct (correct me if I’m wrong), I would be able to actively monitor the running speed(HKQuantityType) by sampling at low intervals(1 second) and also that HealthKit optimises the readings based off device sensors or GPS data accordingly. Just looking to develop for iOS devices only.

Hi @dev_arun, I believe using HealthKit to monitor bicycling would be a great option. It’s a powerful framework and Apple has provided plenty of videos from WWDC that explore many aspect of it. HKQuantityType should work for you in regards to approaching speed. For example starting off with a variable such as: let walkingSpeed = HKQuantityType.quantityType(forIdentifier: .walkingSpeed). Then using that variable to store the numerical value of the walking speed. There are many type properties that are available to use. The distanceCycling type property might be of interest to you as well. Hope this information helps you in the right direction.