HealthConnect in Unity

Hello, I’m creating a game where i need to obtain the step counter from Android Health Connect, i’m not so expert in programming…how can i integrate the API in my project ? anyone had an experience with this ?

thank you very much!

You need to include input system pacakge into your project, and then use https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/api/UnityEngine.InputSystem.StepCounter.html, something like

// In Start method
if (InputSystem.GetDevice<StepCounter>() != null)
    InputSystem.EnableDevice(InputSystem.GetDevice<StepCounter>());


// In Update
if (StepCounter.current != null)
{
    var value = StepCounter.current.stepCounter.ReadValue();
   // Do something with value
}

hello.
We are working to connect Google Health Connect in Unity version 2021.3.27.

To view the pedometer, I must implement connectivity with Google Health Connect.
How do I use the Health Connect API?

Or can I get pedometer information by linking it with Samsung Health?