Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Use HKWorkoutSession and Start an Activity in React Native? #107

Open
heritvithalani19 opened this issue Sep 16, 2024 · 2 comments
Open

Comments

@heritvithalani19
Copy link

Hello,

I am trying to use HKWorkoutSession to start an activity from my React Native app using this library. However, I am unclear on how to correctly initiate a workout session and manage its lifecycle (start, pause, and end). Apple documentation

Specifically, I would appreciate guidance on the following:

How to correctly instantiate an HKWorkoutSession in React Native using this library.
What parameters and configurations are required to start a workout session (e.g., workout type, activity options).
Best practices for monitoring workout session status (active, paused, ended) and handling session completion.
How to capture workout metrics like heart rate, calories, and distance during the session.
Here is a brief overview of my current setup:

React Native version: 0.71.19
HealthKit permissions are already granted.
Thank you for your assistance!

@heritvithalani19
Copy link
Author

@jonstuebe Can you please look?

@robertherber
Copy link
Member

This is not currently featured in the library (saving and querying workouts are however). The approach we use at Kingstinct in regards to QuantitySamples (heart rate, calories burnt etc) is querying for those data points directly for the time period of the workout.

PRs are welcome and we're also open to helping out on a consulting basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants