Problem with auto pause in workouts and duration

I am building a running workout for Apple Watch and I have a problem to implement an "auto-pause" feature. 
Code Block
func workoutSession(_ workoutSession: HKWorkoutSession, didGenerate event: HKWorkoutEvent) {
// Auto-pause
if event.type == HKWorkoutEventType.motionPaused && workoutSettings.autoPause {
print("Auto Pause")
pauseWorkout()
}
if event.type == HKWorkoutEventType.motionResumed && workoutSettings.autoPause {
print("Auto Resume")
resumeWorkout()
}
}

If I pause the session with pauseWorkout (which calls pause() and method of HKWorkoutSession) the session never receives the .motionResumed event. All events are disabled during the pause.
If I don't pause the HKWorkoutSession, it's OK to auto-resume the workout, but the session continues to run and the elapsedTime continues to increase during the auto-pause.
What is the solution .

Replies

You should not pause the workout session when receiving a motionPaused event. Pausing the session is meant to be used when the user takes explicit action to pause the workout (like pressing a button in your UI). The motion detection would be temporarily stopped and, as you noticed, you would not get a motionResumed event.
If you are using an HKLiveWorkoutBuilder and you want to handle motionPaused events, you would create a pause event and insert it on the builder. This would pause the elapsedTime and also avoid including calories, heart rate and other metrics for the pause period into your workout. Once you receive the motionResumed event, you would insert a resume event on the builder for calculations to continue.


I'm wondering if there's a published list of workouts supported for auto generated motionPaused / motion resumed events. For example, is it just for outdoors running and cycling or is walking also supported. Is it supported for indoor running workouts? Any other workout types supported?